On Thu, Sep 9, 2010 at 10:59 PM, Russell Keith-Magee <russ...@keith-magee.com> wrote: > The LazyForeignKey pattern has been proposed by a number of parties; > it's an interesting idea that is worth some serious consideration. > There are some issues with implementation (e.g., exactly how to > describe the relationship in a clean way that doesn't require us to > import settings in order to define models), but these issues shouldn't > be too hard to sort out. I'll see if I can get some discussion going > at the sprints over the next couple of days.
See the blog link I posted, there I propose a factory pattern that allows you to (1) extend the base factory class (2) use the factory to create the actual Django model in your own app, passing any missing bits the factory might be expecting. It solves the "lazy binding" case and also lets you create more than one model with the same structure and functionality attached. As for views I recommend something along the lines of: url(r'^bar/', include('fooapp.urls'), {'model': Bar}), url(r'^baz/', include('fooapp.urls'), {'model': Baz}), -- Patryk Zawadzki -- 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.