Re: Filtering Queryset by Foreign Key Properties

2018-03-31 Thread Daniel Sears
You may want to first write a test for this using something like pytest. That's what I did and the following worked fine. Note that query is a queryset, which is an iterable. So you have to index it. And product__type__name will ultimately match with a string because the name field in ProductType i

Re: Filtering Queryset by Foreign Key Properties

2018-03-31 Thread Jamaldin Pro
Can anyone help me? -- 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@

Filtering Queryset by Foreign Key Properties

2018-03-31 Thread Jamaldin Pro
> > class ProductType(models.Model): > > image = models.ImageField(upload_to='products_type_images/') > name = models.CharField(max_length=20, blank=True, null=True, > default=None) > is_active = models.BooleanField(default=True) > > def __str__(self): > return "%s" % self

Re: Filtering Queryset by Foreign Key Properties

2018-03-30 Thread Jamaldin Pro
> > class ProductType(models.Model): > class Meta: > verbose_name_plural = 'тип' > verbose_name = 'типы' > > image = models.ImageField(upload_to='products_type_images/') > name = models.CharField(max_length=20, blank=True, null=True, > default=None) > is_active = m

Re: Filtering Queryset by Foreign Key Properties

2011-02-11 Thread josch
Thank you both! -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit

Re: Filtering Queryset by Foreign Key Properties

2011-02-11 Thread Axel Bock
Hi, try this, I guess this should workd (being new here myself :): OrderPositions.objects.filter(order__type = "A") and maybe have a look here: http://docs.djangoproject.com/en/1.2/ref/models/querysets/#field-lookups Cheers, Axel. 2011/2/11 josch > Hi, > > I`m searching for a solution for

Re: Filtering Queryset by Foreign Key Properties

2011-02-11 Thread Tom Evans
On Fri, Feb 11, 2011 at 5:20 PM, josch wrote: > Hi, > > I`m searching for a solution for the following problem: > > I have, for example, those two classes: > > class Order(self): >        type = models.CharField(1) > > class OrderPositions(self): >        order = ForeignKey(Order) > > > Now I want

Filtering Queryset by Foreign Key Properties

2011-02-11 Thread josch
Hi, I`m searching for a solution for the following problem: I have, for example, those two classes: class Order(self): type = models.CharField(1) class OrderPositions(self): order = ForeignKey(Order) Now I want to get every Order Position, whoose order has the type, for exampl