You didn't call p.save() anywhere, so the change you made wasn't committed
to the database. All you've done here is made a change to the object in
memory you pulled out of the database, and then over wrote that change by
pulling another copy out of the database.

-James
 On Jul 21, 2015 12:55 AM, "Info Test" <infotest...@gmail.com> wrote:

> When I save my model, there is no effect in database.
> What is the problem?
>
> class Profil(models.Model):
>     user = models.OneToOneField(User)
>
>
> in manage.py shell
>
> >>> p = models.Profil.objects.get(user__username='testname')
>
> >>> p.user.is_superuser
> False
> >>> p.user.is_superuser = True
> >>> p.user.is_superuser
> True
> >>> exit()
> >>> p = models.Profil.objects.get(user__username='testname')
> >>> p.user.is_superuser
>
> False ---------> ????????????????????????????????
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/df7490d5-108e-4960-b80b-8071662d8db1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/df7490d5-108e-4960-b80b-8071662d8db1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUopSKPF_3HScSwpbZYoHt5PUTT9J5ujXz2WfvhaBOm2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to