Django doesnt fetch the latest updated records

I have a very strange problem with Django. I have a form with Name and details and i have options to update this form. When i am updating the form, database updation is occuring immediately and correctly. I am using Postgresql. But when the page that displays the form data loads, the latest updated form data is not reflected in the page. If i want to see the latest updated form, i have to stop the server and restart it. Please some one help me resolve it. Strangley, this is working fine in my local instance. I am having this issue when i hosted it in apache server.

Here is my code.

def Form(request):
     f= Form() # Form is the name of my table
     f.name = request.POST.get('name')
     f.details = request.POST.get('details')
     f.save()

     page = Form.objects.all()
     return render('page.html',{'data':page})

 In page.html
     {% for d in data %}
           {{d.name}}
           {{d.details}}

     {% endfor %}


Source: forms

Leave a Reply