Friday, July 20, 2012

Boolean always returns False?

Hi everyone,

I have a user model in which i have a newsletter boolean field. When the user subscribes to a newsletter, this is checked.
I am then instantiating that user and checking the property, so that if it is False (i.e. unchecked) = I can display a subscription box.

In the model:
newsletter = models.BooleanField(verbose_name=u'Sign up to the newsletter', default=False)

.. and in the view:
print registered_user.newsletter

The print outputs False even though this same user's 'newsletter' field appears checked in the admin. What am I missing?

Thanks.

--
Regards,
Sithembewena Lloyd Dube

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate