Friday, July 20, 2012

Re: Boolean always returns False?

why do you have your own User model? Are you sure you're logging in
the right user and loading the right user instance?

On Fri, Jul 20, 2012 at 12:37 PM, Sithembewena Lloyd Dube
<zebra05@gmail.com> wrote:
> 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.



--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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