How to solve this problem: Custom User with ForeinKey to another model. (model does not exist)

18 views
Skip to first unread message

Fellipe Henrique

unread,
Oct 6, 2015, 9:09:06 AM10/6/15
to Django Users
Hello,

I have my custom user model in my "account" app, and I have in my "core" app..

Inside my "core app" I have my City Model...

But I need each user has to be set the user City... 

My problem: when I apply the migration, I give the error:  "city model" does not exist. even I put the "core app" abouve the "account app" in settings.py.

It's appears django try to make the account migration first, but It's doesn't create yet my "city app"...

What's the better approach to solve these problem?

Regards.  

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

Fellipe Henrique

unread,
Oct 6, 2015, 10:34:04 AM10/6/15
to Django Users
Just to update... these error occurs  when I use PostgreSQL, using SQLite works perfect...

T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

Erol Merdanović

unread,
Oct 6, 2015, 10:51:17 AM10/6/15
to Django users

Fellipe Henrique

unread,
Oct 6, 2015, 1:12:43 PM10/6/15
to Django Users
My problem is NOT the order... but I need to create "core app" first.. after that, install "account app".. because my model in "account app" has a FK to "core app"



T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
Twitter: @fh_bash

--
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 django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/871a9717-9c66-4417-8cbe-3d7f89141313%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Uzhare Farooq

unread,
Oct 6, 2015, 3:10:08 PM10/6/15
to django...@googlegroups.com

If I understand your question correctly, the below given code should solve your issue.

yourFKField = models.ForeignKey('YourModel')

Notice the quotes around YourModel.

> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1jwZHxHWPr5nX59m2N_hRzRc4rs%3DOs_%3DBk3sHtUNGWiKQtKQ%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages