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)
class BasicFieldsViewset(ModelViewSet): template_context = dict(url_reverse='basic-fields') pagination_class = ModelViewSet.generate_paged_loader(30) queryset = BasicFields.objects.all() serializer_class = BasicFieldsSerializer
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
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
class RelationViewset(ModelViewSet): template_context = dict(url_reverse='relation') pagination_class = ModelViewSet.generate_paged_loader(30) queryset = Relation.objects.all() serializer_class = RelationSerializer