1
Django offers an admin interface to directly edit models.
3
>>> from oopstools.oops import djangobrowser
4
>>> from django.contrib.auth.models import User
6
>>> user = User.objects.create_user(
7
... 'john', 'johndoe@example.com', 'test')
9
To access the admin interface, the user must be part of the staff (represented
10
by is_staff attribute) and to edit the models, user must be a super user.
12
>>> user.is_superuser = True
13
>>> user.is_staff = True
16
>>> b = djangobrowser.Browser()
18
Now let's open the admin page.
20
>>> b.open('http://localhost/admin')
24
>>> b.getControl('Username').value = 'john'
25
>>> b.getControl('Password').value = 'test'
26
>>> b.getControl('Log in').click()
28
Browse to the Oops section of the admin site.
30
>>> b.getLink('Oops').click()
33
'http://localhost/admin/oops/'
37
...<h1>Oops administration</h1>