Re: django 1.5, subclass AbstractUser -> NameError: name 'settings' is not defined
On Fri, Nov 02, 2012 at 10:15:11AM +0100, Raffaele Salmaso wrote: > did you forget to include > from django.conf import settings > in /home/michael/www/project/news/models.py? > > -- > | Raffaele Salmaso Yep, adding it did it :) Thanks to both of you! -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django 1.5, subclass AbstractUser -> NameError: name 'settings' is not defined
On Fri, Nov 2, 2012 at 10:11 AM, Michael Musterwrote: > File "/home/michael/www/project/news/models.py", line 28, in News > author = models.ForeignKey(settings.AUTH_USER_MODEL) > NameError: name 'settings' is not defined > NameError: name 'settings' is not defined did you forget to include from django.conf import settings in /home/michael/www/project/news/models.py? -- | Raffaele Salmaso | http://salmaso.org | https://bitbucket.org/rsalmaso | http://gnammo.com -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django 1.5, subclass AbstractUser -> NameError: name 'settings' is not defined
On Fri, Nov 02, 2012 at 04:59:35PM +0800, Russell Keith-Magee wrote: > Can you run: > > ./manage syncdb --traceback > > so we can get the full context of the error message? > Sure, here it is: :~/www/project$ python manage.py syncdb --traceback Traceback (most recent call last): File "/usr/local/bin/django/django/core/management/base.py", line 222, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/local/bin/django/django/core/management/base.py", line 251, in execute self.validate() File "/usr/local/bin/django/django/core/management/base.py", line 277, in validate num_errors = get_validation_errors(s, app) File "/usr/local/bin/django/django/core/management/validation.py", line 34, in get_validation_errors for (app_name, error) in get_app_errors().items(): File "/usr/local/bin/django/django/db/models/loading.py", line 165, in get_app_errors self._populate() File "/usr/local/bin/django/django/db/models/loading.py", line 71, in _populate self.load_app(app_name, True) File "/usr/local/bin/django/django/db/models/loading.py", line 95, in load_app models = import_module('.models', app_name) File "/usr/local/bin/django/django/utils/importlib.py", line 35, in import_module __import__(name) File "/home/michael/www/project/news/models.py", line 27, in class News(models.Model): File "/home/michael/www/project/news/models.py", line 28, in News author = models.ForeignKey(settings.AUTH_USER_MODEL) NameError: name 'settings' is not defined NameError: name 'settings' is not defined What i forgot in my first post is that i reference the user model like this: author = models.ForeignKey(settings.AUTH_USER_MODEL) So if i remove that line the syncdb command works just fine. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
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.mus...@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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django 1.5, subclass AbstractUser -> NameError: name 'settings' is not defined
On Fri, Nov 2, 2012 at 4:34 PM, Michael Muster < michael.mus...@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+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
django 1.5, subclass AbstractUser -> NameError: name 'settings' is not defined
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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.