문제

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.

도움이 되었습니까?

해결책

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

user.save()

which commits the changes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top