Opened 18 years ago
Closed 18 years ago
#4591 closed (invalid)
cannot import name User (error retrieving User from django.contrib.auth)
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Contrib apps | Version: | dev |
Severity: | 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 was making an application that included user profiles, and I thought I was done with the first part so I entered an sql command and got this:
Ian-Smiths-Computer:~/Sites/matches ismith$ python manage.py sql nest matches.cafe: cannot import name User 1 error found. BEGIN; CREATE TABLE `nest_userprofile` ( `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `website` varchar(200) NOT NULL, `about` longtext NOT NULL, `avatar` varchar(100) NOT NULL, `user_id` integer NOT NULL UNIQUE REFERENCES `auth_user` (`id`) ); COMMIT;
Here is what my nest/models.py looks like:
from django.db import models from django.contrib.auth.models import User # Create your models here. class UserProfile(models.Model): website = models.URLField() about = models.TextField() avatar = models.ImageField(upload_to='avatars') user = models.ForeignKey(User, unique=True)
I'm using it to extend the User model, but for some reason it cannot connect to it. I then tried to re-SQL another app in my project that hadn't had a problem, and it gave the same error.
I even included AUTH_PROFILE_MODULE = 'nest.UserProfile'
in my project's settings.py
I was thinking maybe I should redownload django, to reset contrib/auth/models.py, just in case it got modified somehow.
Please post support queries like this to the django-users mailing list. We use Trac only for concrete bug reports (importing the User model should be working, so you probably want to get a bit of help on the mailing list first, before we assume it's a Django bug).