If you didn't start your project with a custom user, it's non-trivial to 
start using one. Please see https://code.djangoproject.com/ticket/25313.

On Friday, December 18, 2015 at 6:55:16 AM UTC-5, Web Architect wrote:
>
> Hi,
>
> I am new to Django and still under the process of learning. We are using 
> an open source ecommerce platform - Oscar - for our online store. Oscar is 
> based on Django.
>
> I was trying to customise the Django User model by extending with some few 
> extra fields/columns:
>
> # file: your-project/apps/user/models.pyfrom django.db import models
>
> from django.contrib.auth.models import AbstractUser
>
> class User(AbstractUser): user_type = models.IntegerField()
>
> # use our own user model in settings.pyAUTH_USER_MODEL = "user.User"
>
> With the above changes, when I run 'makemigration' followed by 'migrate', I 
> am getting the following errors:
>
> *Running migrations:*
>
>   Rendering model states...Traceback (most recent call last):
>
>   File "./manage.py", line 10, in <module>
>
>     execute_from_command_line(sys.argv)
>
>   File 
> "/Users/pinakeebiswas/waltzz/lib/python2.7/site-packages/django/core/management/__init__.py",
>  line 338, in execute_from_command_line
>
>     utility.execute()
>
>   File 
> "/Users/pinakeebiswas/waltzz/lib/python2.7/site-packages/django/core/management/__init__.py",
>  line 330, in execute
>
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>
>   File 
> "/Users/pinakeebiswas/waltzz/lib/python2.7/site-packages/django/core/management/base.py",
>  line 393, in run_from_argv
>
>     self.execute(*args, **cmd_options)
>
>   File 
> "/Users/pinakeebiswas/waltzz/lib/python2.7/site-packages/django/core/management/base.py",
>  line 444, in execute
>
>     output = self.handle(*args, **options)
>
>   File 
> "/Users/pinakeebiswas/waltzz/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
>  line 222, in handle
>
>     executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
>
>   File 
> "/Users/pinakeebiswas/waltzz/lib/python2.7/site-packages/django/db/migrations/executor.py",
>  line 100, in migrate
>
>     state.apps  # Render all real_apps -- performance critical
>
>   File 
> "/Users/pinakeebiswas/waltzz/lib/python2.7/site-packages/django/utils/functional.py",
>  line 60, in __get__
>
>     res = instance.__dict__[self.name] = self.func(instance)
>
>   File 
> "/Users/pinakeebiswas/waltzz/lib/python2.7/site-packages/django/db/migrations/state.py",
>  line 166, in apps
>
>     return StateApps(self.real_apps, self.models)
>
>   File 
> "/Users/pinakeebiswas/waltzz/lib/python2.7/site-packages/django/db/migrations/state.py",
>  line 248, in __init__
>
>     raise ValueError(msg.format(field=operations[0][1], model=lookup_model))
>
> ValueError: Lookup failed for model referenced by field basket.Basket.owner: 
> customer.User
>
>
> I am not sure what's causing the above error. Certainly there could be 
> models which would be dependent on the User model but I thought the 
> makemigrations and migrate should be able to resolve those.
>
> Would appreciate if someone could help me with resolving the above errors.
>
> Thanks
>
>
>
>     

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5087e045-a93b-4173-ae0d-55f0093016d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to