Demo entry 6630279

123

   

Submitted by anonymous on Jul 09, 2017 at 02:20
Language: Python 3. Code size: 459 Bytes.

class LanguageViewSet(viewsets.ModelViewSet):
    serializer_class = LanguageSerializer
    queryset = Language.objects.all()
    permission_classes = (IsStaffOrReadOnly,)

    @list_route()
    def packaged(self, request, *args, **kwargs):
        languages = Language.objects.filter(enabled=True).order_by('locale_name', 'locale_country', 'locale_code')
        ser = LanguageStringSerializer(languages, many=True)
        return Response(ser.data)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).