Hi Daniele, On 03/20/2013 05:46 AM, Daniele Procida wrote: > I have an idea for the URL dispatcher, and I'd like to know what your > thoughts are. > > Often - not always but often - a Django URL will map to a model > instance via a URLconf and a view. > > I can think of a few uses for a feature that used Django's URLconfs > to return the model instance, if there is one, mapped to by a > particular URL. > > In other words, one would feed a URL to the system, which would > return a model instance, if one could be uniquely associated with > that URL.
I think this is an interesting idea for some specific use cases, but I don't think its implementation belongs in the core url-resolver code, for a couple reasons: 1) The pattern is simply not common enough to require an implementation in core Django. 2) It couples the URL resolver to the ORM. These are separate modules that should not need to depend on one another, in either direction. If you work on implementing this outside Django and find that you need hooks that are not currently available, those hooks would making interesting feature proposals for Django. Carl
signature.asc
Description: OpenPGP digital signature
