2009/10/18 Maxim Penzin <mpen...@gmail.com> > > Another crazy idea for shorter object fetch is > "/%(model_name.id)d/" or may be another syntax like "/%%(model_name)/" > to get rid of > get_object_or_404( id=int(id) ) > at the first line of every view method. >
I quite like this idea, not sure about that syntax exactly but the idea is nice. Personally I'm a fan of regular expressions so wouldn't want to see them removed or abstracted to a level that really isn't that different. Something like this however would be more interesting as as you say it skips a bit of code that ends up in many views. It could also be used pass the view pre-filtered querysets. Say for example with date based filters. i.e. /2009/, /2009/09/ and /2009/09/09/ would go to the same view but rather than pass the date or date parts the view is passed the result of a Model.objects.filter() However, I'm at a total loss of how the syntax for this would work :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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 -~----------~----~----~----~------~----~------~--~---