Ok isolved with projet = Projet.objects.filter(fact__isnull=False) Everything 's back to normal :)
On 6 oct, 14:00, gregory semah <gregory.se...@gmail.com> wrote: > Sorry my mistake again... > > I mean when i write "Projet.objects.filter(fact!=None)" instead of > "Projet.objects.filter(fact=None)" > > Thanks > > > > > > > > > > > > Hi All, > > > > I'm dealing with really weird problem > > > > My model > > > class Projet(models.Model): > > > ... > > > fact = models.PositiveIntegerField('Numéro de > > > Facture',null=True,blank=True) > > > ... > > > ... > > > > A simple view from this model is > > > def facture(request, id=None): > > > projet = Projet.objects.all() > > > > So as far as I am, everything worked as expected > > > Now I wanted to change > > > projet = Projet.objects.all() to projet = > > > Projet.objects.filter(fact=None) > > > it will send projet filtered as expected (all projects with no number > > > assigned to the fact field) to template > > > So the template display this as expected... > > > > Now, when I want to filter only projets with a assigned number to the > > > fact field its return > > > > NameError at /facture/ > > > global name 'fact' is not defined > > > > Have i missed something? > > > I'm used with this kind of operation with django , but right now I'm a > > > bit lost... > > > > Thanks in advance > > > > Gregory Sémah -- 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 this group at http://groups.google.com/group/django-users?hl=en.