Skip to content

Instantly share code, notes, and snippets.

@antoviaque
Created January 14, 2014 18:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save antoviaque/8423488 to your computer and use it in GitHub Desktop.
Save antoviaque/8423488 to your computer and use it in GitHub Desktop.
Granting superuser privileges to an existing user in edX
edxapp@edx:~/edx-platform$ ./manage.py lms shell --settings=devstack
Python 2.7.3 (default, Sep 26 2013, 20:03:06)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from django.contrib.auth.models import User
In [3]: u=User.objects.get(email='xavier@antoviaque.org')
In [4]: u.__dict__
Out[4]:
{'_state': <django.db.models.base.ModelState at 0x6020350>,
'date_joined': datetime.datetime(2014, 1, 14, 18, 43, 16, 650913, tzinfo=<UTC>),
'email': u'xavier@antoviaque.org',
'first_name': u'',
'id': 1,
'is_active': True,
'is_staff': False,
'is_superuser': False,
'last_login': datetime.datetime(2014, 1, 14, 18, 43, 17, 312285, tzinfo=<UTC>),
'last_name': u'',
'password': u'pbkdf2_sha256$10000$HvmM30qsT3qF$0QHrCnvVQt4fHHBVcF39UG5nSoI+dM6s2V87cRCNHZM=',
'username': u'XavierAntoviaque'}
In [5]: u.is_staff = True
In [6]: u.is_superuser=True
In [7]: u.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment