Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
location.py 377 B
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse

from web.models import Location


@login_required
def locations(request):
    locations = Location.objects.all()
    data = []
    for location in locations:
        data.append({"id": location.id, "name": location.name})
    return JsonResponse({
        "locations": data
    })