stories icon indicating copy to clipboard operation
stories copied to clipboard

Document usage with Django REST Framework.

Open proofit404 opened this issue 5 years ago • 0 comments

  • Create, update, destroy actions are stories always.
  • List and retrieve if we need to check a very complex set of permissions
  • Get queryset method does not contain implementation.
class Users(ModelViewSet):
    serializer_class = UserSerializer
    queryset = User.objects.all()

    def perform_create(self, serializer):
        serializer.instance = UserCreation().create(**serializer.validated_data)

    def perform_update(self, serializer):
        serializer.instance = UserUpdate().update(**serializer.validated_data)

    def perform_destroy(self, instance):
        UserDeletion().delete(instance)

proofit404 avatar Jul 31 '20 07:07 proofit404