示例#1
0
class AdvancedFieldsViewset(ModelViewSet):
    template_context = dict(url_reverse='advanced-fields')
    pagination_class = ModelViewSet.generate_paged_loader(30)

    queryset = AdvancedFields.objects.all()
    serializer_class = AdvancedFieldsSerializer

    def update(self, request, *args, **kwargs):
        # DynamicForms js client uses only PUT which makes fields checking for all fields. If you dont want to update
        # all fields e.g. upload new file, we should use PATCH method, but current js client does not support this.
        # To enable update of record without re-uploading new file,
        # we enable partial update with line below -> kwargs['partial'] = True
        kwargs['partial'] = True
        return super().update(request, *args, **kwargs)
示例#2
0
class BasicFieldsViewset(ModelViewSet):
    template_context = dict(url_reverse='basic-fields')
    pagination_class = ModelViewSet.generate_paged_loader(30)

    queryset = BasicFields.objects.all()
    serializer_class = BasicFieldsSerializer
示例#3
0
class ChoiceAllowTagsFieldsViewSet(ModelViewSet):
    template_context = dict(url_reverse='choice-allow-tags-fields')
    pagination_class = ModelViewSet.generate_paged_loader(30)

    queryset = AdvancedFields.objects.all()
    serializer_class = ChoiceAllowTagsFieldsSerializer
示例#4
0
class WriteOnlyFieldsViewSet(ModelViewSet):
    template_context = dict(url_reverse='write-only-fields')
    pagination_class = ModelViewSet.generate_paged_loader(30)

    queryset = AdvancedFields.objects.all()
    serializer_class = WriteOnlyFieldsSerializer
示例#5
0
class RelationViewset(ModelViewSet):
    template_context = dict(url_reverse='relation')
    pagination_class = ModelViewSet.generate_paged_loader(30)

    queryset = Relation.objects.all()
    serializer_class = RelationSerializer