I have 3 models:

class Products(models.Model):
        brand = models.ForeignKey(
            Brands,
            verbose_name = "Brand",
        )
        code = models.CharField("Code",
            max_length=25, 
        )
        descr = models.CharField("Description",
            max_length=50, 
        )

class Orders(models.Model):
        brand = models.ForeignKey(
            Brands,
            verbose_name = "Brand",
            null=True,
            blank=True,
            related_name="ord_brand"
        )
        ord_date = models.DateField("Date")
        ord_numb = models.CharField("Number",
            max_length=20,
            unique_for_year="ord_date", 
        )

class OrderRows(models.Model):
        order = models.ForeignKey(
            Orders,
            verbose_name = "Order",
        )
        product = models.ForeignKey(
            Products,
            verbose_name = "Product",
        )
        price = models.DecimalField("Price",
            max_digits = 11,
            decimal_places=2,
        )

In my Admins.py I have a ModelAdmin for Orders whit a Inline for OrderRows.

How can I filter the product queryset in OrderRows where brand=orders.brand?

-- 
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/f54aaba0-bb94-421a-8902-00c6a9f594dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to