Reputation: 378
I'm just startimg to work with django and DRF, and I got a problem, that looks like DRF cache responses. I mean - I can change object, create new, or delete it - and DRF shows in response, that nothing has changed. For example, I create an object, but modelViewSet still return data where the newly created object is not present. But if I directly request the object - it shows that it's created. And so with any another actions. I can't find topic about caching in DRF, and look like I have not any django chaching middlewares, so I have no idea what is going on. Only one thing that helps - restart server ( I'm using default dev-server).
One more thing. All data is ok when it's rendered by django views, but not with DRF views.
Here is one of the serializers/modelViewSets that I'm using. It as simple as possible. And also - I'm not using django cache backends. At least - I don#t any, in my settings.
class WorkOperationSerializer(serializers.ModelSerializer):
class Meta:
model = WorkOperation
class WorkOperationAPIView(viewsets.ModelViewSet):
serializer_class = WorkOperationSerializer
queryset = WorkOperation.objects.all()
def get_queryset(self):
return self.queryset
Upvotes: 13
Views: 6816