So in a class based view inheriting generic.ListView I want to redirect on
a condition, The logical place to do it is get_queryset, but you can't go
returning a HttpResponseRedirect from a method that should return a query
set. The django.shortcuts.redirect() just kinda does that for you so that
doesn't work either. I can raise a Http404 from inside get_queryset, but
not something like raise Redirect('url/').
I saw one answer to the problem where you put the condition
in render_to_response but that'll gets called after get_queryset. I guess
the other option is to put the condition in get and check there and return
redirect. But that seems hacky.
I'm just wonder whats the best way to do this.
Eli Criffield
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/pyY9hQ7iCPAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.