#34252: Doc page "Using the Django authentication system" shows failing example
-----------------------------------------+------------------------
Reporter: jdreo | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
The "Using the Django authentication system" documentation page, in the
"Creating user" section [1], shows an example of how to create users
manually.
However, this example fails.
The example code is:
{{{#!python
>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user('john', '[email protected]',
'johnpassword')
}}}
But running it in a `python manage.py shell` produces the following error:
{{{#!python
>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user('john', '[email protected]',
'johnpassword')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "XXX/lib/python3.8/site-packages/django/db/models/manager.py", line
187, in __get__
raise AttributeError(
AttributeError: Manager isn't available; 'auth.User' has been swapped for
'core.User'
}}}
Documentation shows the same code example up to the "dev" version.
Witnessed on Django 3.2.12, on Linux
core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch, Python 3.8.10
(default, Nov 14 2022, 12:59:47)
[GCC 9.4.0].
[1] https://docs.djangoproject.com/en/3.2/topics/auth/default/#creating-
users
--
Ticket URL: <https://code.djangoproject.com/ticket/34252>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070185a12519e4-24a71dd4-ce73-465d-9c85-c1811b592d95-000000%40eu-central-1.amazonses.com.