Opened 10 years ago
Closed 10 years ago
#26444 closed Bug (duplicate)
Can't set password on User during migration that depends on contrib.auth
| Reported by: | Markus Amalthea Magnuson | Owned by: | nobody |
|---|---|---|---|
| Component: | Migrations | Version: | 1.9 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I have an app with migrations that depend on the contrib.auth migrations. In one of my own migrations I want to create User objects and set their password. When trying to set a password for User object either through .set_password() or directly on creation through e.g. .create_superuser() I get this error:
AttributeError: 'User' object has no attribute 'set_password'
Attached is a test project. Create a virtual env with Django 1.9 and run ./manage.py migrate in it to see the error.
It seems like the password related methods are not available on the User object, only in the default manager, which I gather is not available in migrations. Is this intentional?
Duplicate of #26445.