Resolve "Subscription Depletion"
1 unresolved thread
1 unresolved thread
Subscription enhancements
- It is now possible to 'deactivate subscriptions via the delete http verb
- This is not exactly what was specified in #92 (closed) but should achieve the same result. Instead of introducing a depleted field, subscriptions can distinguish if they are fully depleted or just temporarily. The method does not involve any overhead.
- Refactorings in the subscription model to increase readability
- Creating a subscription does not have side effects (creates no assignment)
Other minor changes
- Assignments are now implicitly checked if feedback is created
- using the assignment endpoint to create subscriptions instead of subscription endpoint
Migrated everything to UUID fields for primary keys
-
submission_pk
->submission
onAssignmentSerializer
- subscriptions now uniformly use the primary key of a model for the
query_key
- introduced remaining and available fields on subscription
- query key and type are now validated
Closes #93 (closed) and #92 (closed).
Edited by Jan Maximilian Michal
Merge request reports
Activity
98 93 instance = self.get_object() 99 94 100 95 if instance.is_done: 101 return Response(status=status.HTTP_403_FORBIDDEN) # test 96 return Response(status=status.HTTP_403_FORBIDDEN) 102 97 103 98 instance.delete() 104 return Response(status=status.HTTP_204_NO_CONTENT) # test 99 return Response(status=status.HTTP_204_NO_CONTENT) 100 101 def create(self, request, *args, **kwargs): 102 context = self.get_serializer_context() 103 serializer = AssignmentDetailSerializer(data=request.data, Yea, just noticed the difference between the serializers. I agree, it's more explicit than this pattern:
class DualSerializerViewSet(viewsets.ModelViewSet): def get_serializer_class(self): if self.action == 'list': return serializers.ListaGruppi if self.action == 'retrieve': return serializers.DettaglioGruppi return serializers.Default # I dont' know what you want for create/destroy/update.
Edit: from https://stackoverflow.com/questions/22616973/django-rest-framework-use-different-serializers-in-the-same-modelviewset Edit2: although
overwriting get_serializer_class()
is drier But both workEdited by robinwilliam.hundt
- Resolved by Jan Maximilian Michal
Please register or sign in to reply