r4fek / django-cassandra-engine

Django Cassandra Engine - the Cassandra backend for Django
BSD 2-Clause "Simplified" License
364 stars 85 forks source link

REST API not refreshing #129

Open jdantes-wave opened 5 years ago

jdantes-wave commented 5 years ago

The REST API in your testproject/ does not refresh when there is new data; the whole server (i.e. python manage.py runserver) must be restarted manually for each new request to show new data.

cassandra-driver 3.17.0 Django 2.2 djangorestframework 3.9.2

r4fek commented 3 years ago

Did you manage to resolve this?

sopje commented 1 year ago

Hi, we are facing the same issue. Does anyone have a solution?

r4fek commented 1 year ago

Please try to use get_queryset instead of relaying on queryset attribute. See the docs: https://www.django-rest-framework.org/api-guide/generic-views/#get_querysetself

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

@sopje please let me know if it helps.