Skip to content

Instantly share code, notes, and snippets.

@antoviaque
Created February 27, 2014 01:12
Show Gist options
  • Select an option

  • Save antoviaque/9242298 to your computer and use it in GitHub Desktop.

Select an option

Save antoviaque/9242298 to your computer and use it in GitHub Desktop.
In [1]: from django.contrib.auth.models import User
In [2]: u=User.objects.get(email='xavier@antoviaque.org')
In [3]: u.__dict__
Out[3]:
{'_state': <django.db.models.base.ModelState at 0x608e3d0>,
'date_joined': datetime.datetime(2013, 12, 27, 16, 51, 45, tzinfo=<UTC>),
'email': u'xavier@antoviaque.org',
'first_name': u'',
'id': 1L,
'is_active': True,
'is_staff': False,
'is_superuser': False,
'last_login': datetime.datetime(2014, 2, 27, 1, 2, 17, tzinfo=<UTC>),
'last_name': u'',
'username': u'XavierAntoviaque'}
In [4]: u.is_staff=True
In [5]: u.is_superuser=True
In [6]: u.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment