Pregunta

I'm creating an admin interface for a customer (separate from the supplied Django admin interface), and I need a way to change a user's superuser/staff status.

I can fetch the User object for a specified user, but I don't know how to change the superuser/staff status for that User.

Not surprisingly, doing

user.is_superuser = False

didn't work.

¿Fue útil?

Solución

See Scott Woodall's comment above. I forgot to do:

user.save()

which commits the changes.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top