Hello everyone, I have a problem and I don't understand how to solve it.
I have a simple model:
Supplier(models.Model):
organization = models.CharField(..)
location = models.ManyToManyfield(Location, blank=True)
Location(models.Model):
address = models.CharField(..)
active = models.BooleanField(default=True)
I created the inlineform to use in the supplier django-admin page:
class LocationInLineForm(admin.TabularInLine):
model = Supplier.Location.through
I would like to show the records in the inlineform based on the supplier page in django admin. An administrator in the django admin click on a supplier and the inlineform must shows only the location owned by the selected supplier.
- I don't understand which method override (get_queryset? formfield_for_foreignkey?)
- I don't know how to get the is of the supplier loaded in the django admin.
I would like also filter the location based on the active boolean field. Is possible to do that?
Thanks
--