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
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
--
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...@googlegroups.com.
To post to this group, send email to django...@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.
For more options, visit https://groups.google.com/d/optout.
Are you getting any sort of error when you run save()? Are the changes reflected in the database after the save() call? Can you perform the same operation directly on the user object?
Also, this operation shouldn't require any arguments to save().
-James
Even with p.save(force_update = True) , it doesn't work
--
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...@googlegroups.com.
To post to this group, send email to django...@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/44c307bd-8c0a-4924-810f-ab0f2eb123ae%40googlegroups.com.
Did you "python manage.py migrate"?
Any error appear on console, is it possible that only superuser can do that?
--
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...@googlegroups.com.
To post to this group, send email to django...@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/8e3bd42d-da1c-42a1-be11-296c2d49d208%40googlegroups.com.