On Dec 19, 2005, at 10:30 PM, oggie rob wrote:
Jacob says:
I kinda think it should be::

class Poll(Model):
        ...

class Choice(Model):
       poll = ForeignKey(Poll)

       class ADMIN:
               edit_inline_on_relation = 'poll'

But in (almost?) all other ways the admin section represents the view
for the current model only. And what we are saying here instead is that
it represents a view for a different model.

Yeah, I don't think I explained myself well enough; let me give a concrete example of why I'd like this:

So we sell this commercial CMS based on Django. It's the same software which runs all our sites, which often means that we need to add Lawrence-specific code in some way. One of these cases is our yearly "Best of Lawrence" awards where readers vote on the best restaurant, bar, etc. This info is tied to our Place model, but it obviously doesn't make sense to include this in the core, so what we do is::

        ellington.core.places:

                class Place(Model):
                        ...

        worldonline.lcom.best_of:

                from django.models import places

                class BestOfLawrenceAward(Model):
                        place = ForeignKey(places.Place, edit_inline=True)

If we had to edit the Place model to add the BestOfLawrenceAward it would basically make the loose coupling impossible. I agree it's a little strange, but I think the gains are big enough that the inline flag should stay on the related object, instead of the related-to object.

This same philosophy, by the way, governs the way that I don't need to explicitally flag the relation from Place back to BestOfLawreceAward to make place.get_bestoflawrenceaward_list() work.

Jacob

Reply via email to