Note that there are some explanatory texts on larger screens.

plurals
  1. POModel.objects.all() won't refresh using djangoappengine
    text
    copied!<p>I'm wondering if the queryset manager in django-nonrel is broken, but I may just be missing something about how to use it. Here's my issue:</p> <p>I've put together a simple blog using Django, but using <a href="http://www.allbuttonspressed.com/projects/djangoappengine" rel="nofollow">djangoappengine</a>. The model I use for the blog entries is called an Entry.</p> <p>I have a view for deleting entries. Once an entry is deleted, it redirects to the home page, which lists all the remaining entries. The trouble is, the first time the redirect happens the entry which I just deleted remains there. If I refresh the page, it disappears from the list. The issue seems to be that even though I call Entry.objects.all() after deleting the entry, it is caching the values from earlier.</p> <p>I moved the code over to a normal Django project and this bug didn't manifest, so I think it's to do with the queryset manager in django-nonrel.</p> <p>I've tried doing lots of different things but I can't work out how requery the database. Here's some code for the view - I've simplified it so it doesn't even redirect, it just renders to response the entry_list with a call to Entry.objects.all(). Still the same problem.</p> <pre><code>def update_or_delete_object(request, *args, **kwargs): "A wrapper around the generic update_object view which allows a delete button too." if request.method == 'POST' and 'delete' in request.POST: #If they've just clicked the delete button object = get_object_or_404(Entry, pk=kwargs['object_id']) object.delete() return render_to_response('entry_list.html', {'object_list':Entry.objects.all()}) return update_object(request, *args, **kwargs) </code></pre> <p>Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload