On Mar 19, 1:22 pm, BobAalsma <b...@leaddevice.com> wrote: > In models.py, when I use > class GevondenManager(models.Manager): > def get_query_set(self): > return > super(GevondenManager,self).get_query_set().filter(crcWaarde > = 0) > I get proper answers. > > However, I want to filter on "not equal to" and this does not seem to > work. How to proceed? > > I have tried > class GevondenManager(models.Manager): > def get_query_set(self): > return > super(GevondenManager,self).get_query_set().filter(crcWaarde > <> 0) > > as well as > class GevondenManager(models.Manager): > def get_query_set(self): > return > super(GevondenManager,self).get_query_set().filter(crcWaarde ! > = 0) > > and in both cases the results seem the same: <snip> > NameError: global name 'crcWaarde' is not defined
This needs to be a standard filter expression. So you use the normal Django query filter syntax as documented here: http://docs.djangoproject.com/en/1.1/topics/db/queries/#retrieving-specific-objects-with-filters Don't forget these are *parameters to a function*, not expressions in themselves. So in your case you need: return super(GevondenManager,self).get_query_set().exclude(crcWaarde=0) -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.