Re: Filtering queryset using two fields in one model

2009-12-08 Thread pbzRPA
o:django- > > users+ow...@googlegroups.com] On Behalf Of pbzRPA > > Sent: Tuesday, December 08, 2009 7:19 PM > > To: Django users > > Subject: Filtering queryset using two fields in one model > > > Hi, > > > I am not sure if this is a really stupid question but ho

RE: Filtering queryset using two fields in one model

2009-12-08 Thread Boris Schäling
> -Original Message- > From: django-users+ow...@googlegroups.com [mailto:django- > users+ow...@googlegroups.com] On Behalf Of pbzRPA > Sent: Tuesday, December 08, 2009 7:19 PM > To: Django users > Subject: Filtering queryset using two fields in one model > > H

Re: Filtering queryset using two fields in one model

2009-12-08 Thread Peter Sagerson
Assuming you're using Django 1.1, take a look at: http://docs.djangoproject.com/en/1.1/topics/db/queries/#filters-can-reference-fields-on-the-model On Dec 8, 2009, at 10:18 AM, pbzRPA wrote: > Hi, > > I am not sure if this is a really stupid question but how can you > filter a model by comparin

Filtering queryset using two fields in one model

2009-12-08 Thread pbzRPA
Hi, I am not sure if this is a really stupid question but how can you filter a model by comparing two of it's own fields? for example: class X(models.Model): id = models.IntegerField() new_id = models.IntegerField() now I want to say X.objects.filter(id = new_id) Thanks -- You received t