Hi Mathew, > class Party(models.Model): > <basic info> > > class Partygoer(models.Model): > <basic info> > party = models.ForeignKey(Party) > > class Conversation(models.Model): > party = models.ForeignKey(Party, edit_inline=models.TABULAR) > partygoer = models.ForeignKey(Partygoer, core=True) > subject = models.CharField(max_length=50)
<snip> > Assuming that the database is full of Parties and Partygoers, I can then > go to the Party admin page and add a Conversation by selecting a > Partygoer in the drop down box. This all works OK - but the list of > Partygoers would be unnecessarily long. It should only show Partygoers > from that one Party - the one whose page I'm currently on. However, it > shows a complete list of Partygoers instead. That's because Django can not read your mind. At least, not yet :) At the point where you are creating inline Conversations under a Party, the Django Admin treats partygoer and subject as just additional regular fields. The Admin doesn't follow Conversation.partygoer back to a specific Party via the Foreign Key because it can't assume that all use-cases will always want that kind of restriction just because Conversation.partygoer somehow relates back to a Party through an intermediate object. There can easily be another use-case where all partygoers may be selected in the inline object. > > This seems quite pointless now, but my real application (nothing to do > with parties!) has quite a lot of data, and the drop-downs are filled > with hundreds of unnecessary entries. How can I restrict it to just the > applicable ones? Is there an edit_inline setting I'm missing, or is the > admin system just not built for this kind of relationship? > If you have a real/serious application like that, you should consider building out your own administrative views. The Admin is fantastic for maintenance type activities, but once you start needing custom filters, customer relationships, validations, workflows, it's best to bite the bullet and create your own rather than trying to find workarounds to make the Admin make your coffee so to speak. -Rajesh --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---