On Thu, Sep 9, 2010 at 3:59 PM, Russell Keith-Magee <russ...@keith-magee.com> wrote:
> What you're proposing here is two things: a LazyForeignKey, and > configurable applications. not really, it's only configurable applications. once you have that, it's easy to make the ForeignKey depend on a parameter. > Configurable apps were the subject of Arthur Koziel's GSoC project > this year. From my conversations with Jannis this week at DjangoCon, > it sounds like this GSoC code is in pretty good shape. However, in > order to smooth the path, we will probably end up landing some > preliminary work for 1.3, and land the final patch for 1.4. yes, i've just seen the link posted by Yuri. maybe GSoC projects could use some more visiblity, a Git fork of the whole Django code doesn't make it easy to know what's happening there. judging just from the GSoC proposal, an app object could make a lot of OOP goodness available. > 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. it all that really necessary? i'd think that just not using hardcoded constants for the model class or name buys a _lot_ of flexibility. of course, that's easily doable right now. the simplest case would be just using settings variables: in settings.py: FAVORITES_FAVE_MODEL=‘pages.models.Page' in favorites/models.py: class Favorite(models.Model): item = ForeignKey(settings.FAVORITES_FAVE_MODEL) user = ForeignKey(User) date = DateTimeField(default=utcnow) but that's just ugly, and pollutes a global namespace. hence, configurable apps :-) -- Javier -- 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.