Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API not refreshing #129

Open
jdantes-wave opened this issue Apr 22, 2019 · 3 comments
Open

REST API not refreshing #129

jdantes-wave opened this issue Apr 22, 2019 · 3 comments

Comments

@jdantes-wave
Copy link

jdantes-wave commented Apr 22, 2019

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
Copy link
Owner

r4fek commented Jun 10, 2021

Did you manage to resolve this?

@sopje
Copy link

sopje commented Oct 26, 2022

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

@r4fek
Copy link
Owner

r4fek commented Oct 28, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants