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


-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACeuRGX1XQTi%3Du1zLQzwcgDS6eQsqpNap5Ez0Rr69fEz-hiYuQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to