Django 1.5 custom user problems: "Cannot resolve keyword 'user' into field." -


i've converted large django solution 1.5's custom user model. seems have gone smoothly (the app starts , allows me log in) i'm seeing strange behavior when trying filter clause involving new model.

in settings.py:

auth_user_model = 'acct.account' 

in models.py:

class accountmanager(baseusermanager):     def create_user(self, email, password=none, **extra_fields):         = timezone.now()         if not email:             raise valueerror('the email address must set.')         email = accountmanager.normalize_email(email)         user = self.model(email=email,                       is_staff=false, is_active=true, is_superuser=false,                       last_login=now, date_joined=now, **extra_fields)          user.set_password(password)         user.save(using=self._db)         return user      def create_superuser(self, email, password, **extra_fields):         u = self.create_user(email, password, **extra_fields)         u.is_staff = true         u.is_active = true         u.is_superuser = true         u.save(using=self._db)         return u  class account(abstractbaseuser):     email = models.emailfield(unique=true)     first_name = models.charfield(max_length=30, blank=true)     last_name = models.charfield(max_length=30, blank=true)     is_staff = models.booleanfield(default=false)     is_active = models.booleanfield(default=true)     is_superuser = models.booleanfield(default=false)     date_joined = models.datetimefield(default=timezone.now)      username_field = 'email'      objects = accountmanager()      def get_full_name(self):         return u' '.join((self.first_name, self.last_name))      def get_short_name(self):         return self.first_name     ...more fields  

this works fine:

>>> ph.acct.models import account >>> = account.objects.get(id=1) >>>  <account: first last test user> 

but query involves filter or join fails:

>>> account.objects.filter(first_name__icontains='first') traceback (most recent call last): file "<console>", line 1, in <module> file ".../django/db/models/query.py", line 77, in __repr__ data = list(self[:repr_output_size + 1]) file ".../django/db/models/query.py", line 92, in __len__ self._result_cache.extend(self._iter) file ".../django/db/models/query.py", line 301, in iterator row in compiler.results_iter(): file ".../django/db/models/sql/compiler.py", line 775, in results_iter rows in self.execute_sql(multi): file ".../django/db/models/sql/compiler.py", line 830, in execute_sql sql, params = self.as_sql() file ".../django/db/models/sql/compiler.py", line 75, in as_sql ordering, ordering_group_by = self.get_ordering() file ".../django/db/models/sql/compiler.py", line 394, in get_ordering self.query.model._meta, default_order=asc): file ".../django/db/models/sql/compiler.py", line 420, in find_ordering_name field, col, alias, joins, opts = self._setup_joins(pieces, opts, alias) file ".../django/db/models/sql/compiler.py", line 453, in  _setup_joins opts, alias, false) file ".../django/db/models/sql/query.py", line 1332, in setup_joins  "choices are: %s" % (name, ", ".join(names))) fielderror: cannot resolve keyword 'user' field. choices are: ...all of account object's fields , relationships 

what have done wrong?

thanks suggestions. turned out ordering statement old profile model's meta, started "user__last_name". ugh.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -