19 nov 07
The other day at work I was attacked by my coworkers who demanded an explanation for my hatred of Django’s generic views, and by attacked I mean they asked very nicely. The thing is, this is really not true. It’d be more accurate to say “my lack of generic views in code I’ve written for work so far.” This blog runs on generic views. I wrote a small app on Friday for fun work that only used generic views.
Less code is almost always better than more code, so if generic views, or likely wrapped generic views allow you to write less code, that is ideal. The thing is, trust me, people can write more code in order to use generic views. And if you’ve got other things in your view file anyway, a little get_object_or_404 and render_to_response will take care of you pretty quickly, too.
In conclusion: use generic views, use shortcuts, use both, and write less code!