#22575 closed Uncategorized (fixed)
auth.User model doesn't exist
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.6 |
Severity: | Normal | Keywords: | auth.User |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Hello all, I was trying to follow the documentation and importing User from auth module but it didn't work, so I used auth.get_user_model() instead. Would you update the documentation accordingly, please?
The documentation link that has the error is https://docs.djangoproject.com/en/1.6/topics/class-based-views/generic-editing/
I am using Django version 1.6.4 final
Sincerely,
Abdul
Attachments (1)
Change History (10)
by , 11 years ago
Attachment: | generic-editing.txt added |
---|
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 11 years ago
Resolution: | fixed → invalid |
---|
- Importing the
User
model certainly works; if you run into trouble, please see TicketClosingReasons/UseSupportChannels for ways to get help. - Using
get_user_model()
in aForeignKey
declaration is wrong and will raise an exception in Django 1.7; if you want to support custom user models, the proper idiom isForeignKey(settings.AUTH_USER_MODEL)
- The change proposed above wasn't committed, so the ticket should have stayed open until someone had either committed the change or rejected the ticket — which I'm doing now.
comment:4 by , 11 years ago
I am using Django 1.6.4 and I tried from django.contrib.auth import User
and it didn't work for me. I propose to modify the importing path to look like from django.contrib.auth.models import User
.
Sincerely,
Abdul
comment:5 by , 11 years ago
Resolution: | invalid |
---|---|
Status: | closed → new |
Triage Stage: | Unreviewed → Accepted |
Oh, yeah, there's a typo in the import line. I was misled by the suggestion to switch to get_user_model()
.
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I modifyed line 183 and line 188 from User to get_user_model