The Python Oracle

Django doesn't update HTML template after `model.save()`

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Track title: CC F Haydns String Quartet No 53 in D

--

Chapters
00:00 Question
01:30 Accepted answer (Score 4)
01:55 Answer 2 (Score 0)
02:10 Thank you

--

Full question
https://stackoverflow.com/questions/5488...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#javascript #python #ajax #django #djangorestframework

#avk47



ACCEPTED ANSWER

Score 4


Try adding the "never_cache" decorator to the view reponsible for page rendering:

from django.views.decorators.cache import never_cache

@never_cache
def myview(request, ...):
   ...

or to the dispatch method if it's a CBV:

class MyView(View):

    @never_cache
    def dispatch(self,request,*args,**kwargs):
        return super().dispatch(request,*args,**kwargs)



ANSWER 2

Score 0


Can you try to use location.reload(true). Maybe it takes page from cash.