Re: Filter ForeignKey values in model's admin view

2013-11-19 Thread tim
I don't see an easy way to do this offhand. Filtering the ForeignKey queryset using ModelAdmin.formfield_for_foreignkey [1] seems close, but I don't think there's any way to incorporate the values from the M2M field in your filtering. Have you considered writing some JavaScript to do the filter

Re: Filter ForeignKey values in model's admin view

2013-11-19 Thread Michal Ludvig
On 19/11/13 17:10, Michal Ludvig wrote: > > Hi > > I've got two Django models: Contact and Group, where Group has two > fields: contact and contact_primary linked to Contact. Like this: > > |class Group(models.Model): > name = models.CharField(max_length=200) > contacts = models.ManyToManyF

Filter ForeignKey values in model's admin view

2013-11-18 Thread Michal Ludvig
Hi I've got two Django models: Contact and Group, where Group has two fields: contact and contact_primary linked to Contact. Like this: |class Group(models.Model): name = models.CharField(max_length=200) contacts = models.ManyToManyField(Contact) contact_primary = models.ForeignKey(Co