Friday, November 2, 2012

Re: django 1.5, subclass AbstractUser -> NameError: name 'settings' is not defined

(Apologies for the first reply -- my send button misfired…)

Hi Michael,

It sounds like something else - not related to the your User model - is going wrong with your app; the error about settings doesn't sound like something the auth system would be generating.

Can you run:

./manage syncdb --traceback

so we can get the full context of the error message?

Yours,
Russ Magee %-)

On Fri, Nov 2, 2012 at 4:34 PM, Michael Muster <michael.muster@googlemail.com> wrote:
Hi,

I am using django 1.5 and want to add an extra
field to the django user class.
The documentation says that i have to subclass AbstractUser
and add extra fields to it.

So i tried it, in my app 'news' i have:

from django.contrib.auth.models import AbstractUser

class cpUser(AbstractUser):
    twitter = models.CharField(max_length=100)
    def __unicode__(self):
        return self.twitter


and in my settings.py file:

AUTH_USER_MODEL = 'news.cpUser'

however, after running

$ python manage syncdb

i get

NameError: name 'settings' is not defined

What am i doing wrong?



best regards,
Michael

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment