17 lines
714 B
Python
17 lines
714 B
Python
from rest_framework.decorators import api_view, permission_classes
|
|
from rest_framework.permissions import IsAuthenticated
|
|
from rest_framework.response import Response
|
|
|
|
from vbv_lernwelt.core.models import Organisation
|
|
from vbv_lernwelt.core.serializers import OrganisationSerializer
|
|
from vbv_lernwelt.shop.models import Country
|
|
from vbv_lernwelt.shop.serializers import CountrySerializer
|
|
|
|
|
|
@api_view(["GET"])
|
|
@permission_classes([IsAuthenticated])
|
|
def list_entities(request):
|
|
organisations = OrganisationSerializer(Organisation.objects.all(), many=True).data
|
|
countries = CountrySerializer(Country.objects.all(), many=True).data
|
|
return Response({"organisations": organisations, "countries": countries})
|