One benefit with function based views that is lost with generic views is bailing (returning early) conditionally.
Say you have a view returns its response if a condition is meet otherwise does some more possible expensive stuff and then returns. Its nice to bail and avoid the expensive stuff. Im not sure of a simple way to do this with generic class based views. Ill give a simple example to make if clear. Example:: class MyView(DetailView): ... def get(self, request, pk, slug): response = super(MyView, self).get(request, pk, slug) if self.object.slug != slug: return redirect(self.object.get_absolute_url()) return response As you can see we are redirecting if the objects slug does not match the one in the url. Of course i can just query based on pk and slug, but that is not the point :) This seems like its currently the best place to put the slug check since self.object gets set in super get but that also generates the http response and that seems wasteful if the slugs don't match. One possible solution is to make self.get_object cache the object then you could call it before super(..., self).get. Another idea which kind of smells, is some sort of way to short circuit the view processing:: .... def get(request, **kwargs): results = self.get_some_results() return super(..., self).get(request, **kwargs) def get_some_results(): raise FailFast(self.fail_method) ... -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.