On Dec 19, 2005, at 8:48 PM, oggie rob wrote:
One comment: something that has been bugging me for a while is the
location where you specify the inline behaviour.

For example (using the Poll/Choice models):
class Choice(meta.Model):
    poll = meta.ForeignKey(Poll, edit_inline=meta.STACKED,
num_in_admin=3)

Specifying the view for a related table here seems fundamentally wrong!

Yes, I think I agree. That syntax predates separation of the admin from the core, and for clarity it should be removed to the admin declaration. I'm not sure about the syntax; I'm not sure I like what you proposed:

class Poll(meta.Model):
   class ADMIN:  # or whatever the new syntax is!
       fields = ['field1', 'field2']
       inline_elements = (['Choice', meta.STACKED],)

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

I kinda think it should be::

class Poll(Model):
        ...

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

        class ADMIN:
                edit_inline_on_relation = 'poll'

The nice thing about doing it this way is that if I later add another object that needs to be on the Poll admin -- even if it's in another module -- I don't need to edit the Poll definition to make it happen. This is especially helpful when you've lot lots of inline bits, some of which might be optional.

Jacob

Reply via email to