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

web api for accessing appointment types

parent 7805ed2e
No related branches found
No related tags found
1 merge request!8Resolve "Adding appointment"
......@@ -17,9 +17,10 @@ from django.conf.urls import url
from web import api_views
urlpatterns = [
url(r'cities$', api_views.cities, name='web.api.cities'),
url(r'countries$', api_views.countries, name='web.api.countries'),
url(r'specializations$', api_views.specializations, name='web.api.specializations'),
url(r'units$', api_views.units, name='web.api.units'),
url(r'referrals$', api_views.referrals, name='web.api.referrals'),
url(r'^cities$', api_views.cities, name='web.api.cities'),
url(r'^countries$', api_views.countries, name='web.api.countries'),
url(r'^specializations$', api_views.specializations, name='web.api.specializations'),
url(r'^units$', api_views.units, name='web.api.units'),
url(r'^referrals$', api_views.referrals, name='web.api.referrals'),
url(r'^appointment_types$', api_views.appointment_types, name='web.api.appointment_types'),
]
......@@ -43,3 +43,16 @@ def units(request):
return JsonResponse({
"units" : [x[0] for x in X]
})
@login_required
def appointment_types(request):
appointments = AppointmentType.objects.filter().all()
result = []
for appointment in appointments:
result.append({
"type": appointment.code,
"default_duration": appointment.default_duration,
"can_be_parallelized: ": appointment.can_be_parallelized})
return JsonResponse({
"appointments" : result
})
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