Skip to content
Snippets Groups Projects
Commit f7f0aa5b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

base configuration api

parent 00d954b0
No related branches found
No related tags found
1 merge request!36Resolve "configuration panel"
...@@ -15,7 +15,7 @@ Including another URLconf ...@@ -15,7 +15,7 @@ Including another URLconf
""" """
from django.conf.urls import url from django.conf.urls import url
from web.api_views import worker, location, subject, appointment_type, appointment from web.api_views import worker, location, subject, appointment_type, appointment, configuration
urlpatterns = [ urlpatterns = [
# appointments # appointments
...@@ -24,6 +24,9 @@ urlpatterns = [ ...@@ -24,6 +24,9 @@ urlpatterns = [
# appointment types # appointment types
url(r'^appointment_types$', appointment_type.appointment_types, name='web.api.appointment_types'), url(r'^appointment_types$', appointment_type.appointment_types, name='web.api.appointment_types'),
# appointments
url(r'^configuration_items$', configuration.configuration_items, name='web.api.configuration'),
# subjects data # subjects data
url(r'^cities$', subject.cities, name='web.api.cities'), url(r'^cities$', subject.cities, name='web.api.cities'),
url(r'^countries$', subject.countries, name='web.api.countries'), url(r'^countries$', subject.countries, name='web.api.countries'),
......
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
from web.models import ConfigurationItem
@login_required
def configuration_items(request):
items = ConfigurationItem.objects.all()
data = []
for configuration_item in items:
data.append({
"id": configuration_item.id,
"name": configuration_item.name,
"value": configuration_item.value
})
return JsonResponse({
"data": data
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment