from .models import * from .forms import * from django.http import JsonResponse def cities(request): X = Subject.objects.all().values_list('city').distinct() return JsonResponse({ "cities" : [x[0] for x in X if len(x) > 0] }) def countries(request): X = Subject.objects.all().values_list('country').distinct() return JsonResponse({ "countries" : [x[0] for x in X if len(x) > 0] }) def referrals(request): X = Subject.objects.all().values_list('referral').distinct() return JsonResponse({ "referrals" : [x[0] for x in X if len(x) > 0] }) def specializations(request): X = Worker.objects.all().values_list('specialization').distinct() return JsonResponse({ "specializations" : [x[0] for x in X if len(x) > 0] }) def units(request): X = Worker.objects.all().values_list('unit').distinct() return JsonResponse({ "units" : [x[0] for x in X if len(x) > 0] })