Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I have two models Profile and Relationship
- #Serializer class
- class ProfileSerializer(serializers.ModelSerializer):
- class Meta:
- model = Profile
- fields = ['first_name','last_name','bio','email','avatar']
- #API view class
- class ReceivedInvitesList(generics.GenericAPIView,mixins.ListModelMixin):
- serializer_class = ProfileSerializer
- def get_queryset(self):
- profile = Profile.objects.get(user=self.request.user)
- queryset = Relationship.objects.invitations_received(profile)
- return queryset
- def get(self, request):
- return self.list(request)
- #Rest framework browser response
- HTTP 200 OK
- Allow: GET, POST, OPTIONS
- Content-Type: application/json
- Vary: Accept
- [
- {},
- {},
- {}
- ]
Add Comment
Please, Sign In to add comment