"Projet.objects.filter(fact!=None)"
The NameError appears
Thanks
On 6 oct, 13:54, gregory semah <gregory.se...@gmail.com> wrote:
> 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment