Opened 15 years ago

Closed 15 years ago

#4591 closed (invalid)

cannot import name User (error retrieving User from django.contrib.auth)

Reported by: icsmith12@… 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


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 sql nest cannot import name User
1 error found.
CREATE TABLE `nest_userprofile` (
    `website` varchar(200) NOT NULL,
    `about` longtext NOT NULL,
    `avatar` varchar(100) NOT NULL,
    `user_id` integer NOT NULL UNIQUE REFERENCES `auth_user` (`id`)

Here is what my nest/ 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

I was thinking maybe I should redownload django, to reset contrib/auth/, just in case it got modified somehow.

Change History (1)

comment:1 Changed 15 years ago by Malcolm Tredinnick

Resolution: invalid
Status: newclosed

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).

Note: See TracTickets for help on using tickets.
Back to Top