class CountryReportViewSet(viewsets.ModelViewSet): permission_classes = (Or(IsAuthenticated, get_guest_permissions_class(['list', 'retrieve'])), ) serializer_class = CountryReportSerializer queryset = CountryReport.objects.all() def list(self, request, *args, **kwargs): queryset = CountryReport.objects.all() serializer = CountryReportSerializer(queryset, many=True) return Response(serializer.data) def retrieve(self, request, pk=None, *args, **kwargs): queryset = CountryReport.objects.all() countryreport = get_object_or_404(queryset, pk=pk) serializer = CountryReportRetrieveSerializer(countryreport) return Response(serializer.data)
class SectionViewSet(viewsets.ModelViewSet): queryset = Section.objects.filter(parent=None) permission_classes = (Or(IsAuthenticated, get_guest_permissions_class(['list', 'retrieve'])), ) serializer_class = SectionSerializer
class MapPointViewSet(viewsets.ModelViewSet): permission_classes = (Or(IsAuthenticated, get_guest_permissions_class(['list', 'retrieve'])), ) queryset = MapPoint.objects.all() serializer_class = MapPointSerializer