Hi all,

I'm having trouble restricting the values of the drop-down boxes on an 
edit_inline admin section to reflect the value of the parent page that 
it's being edited in. For example (this is not my project, but something 
simpler I just thought of).

Say, for some bizarre reason, I wanted to record the people I'd seen at 
parties, and the conversations I'd had with them. I'd have a Party model 
with some info, and a Partygoer model linked by FK to a Party. Then I'd 
have a Conversation model.

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)

Now, I really only need a foreign key linking a Conversation with a 
Partygoer (because that would, in turn, link it to a party), but I want 
to be able to add conversations inline via the Party page instead, so I 
add an FK to Party as well, and set it to edit_inline.

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.

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?

Many thanks,
Mathew.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to