Tuesday, October 6, 2015

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

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

yourFKField = models.ForeignKey('YourModel')

Notice the quotes around YourModel.
On Oct 6, 2015 10:41 PM, "Fellipe Henrique" <fellipeh@gmail.com> wrote:
>
> 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'
> Blog: http://fhbash.wordpress.com/
> GitHub: https://github.com/fellipeh
> Twitter: @fh_bash
>
> On Tue, Oct 6, 2015 at 11:51 AM, Erol Merdanović <zasebnost@gmail.com> wrote:
>>
>> If the order is the problem, then you can define dependencies
>>
>> https://docs.djangoproject.com/en/1.8/howto/writing-migrations/#controlling-the-order-of-migrations
>>
>> On Tuesday, 6 October 2015 16:34:04 UTC+2, Fellipe Henrique wrote:
>>>
>>> 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'
>>> Blog: http://fhbash.wordpress.com/
>>> GitHub: https://github.com/fellipeh
>>> Twitter: @fh_bash
>>>
>>> On Tue, Oct 6, 2015 at 10:08 AM, Fellipe Henrique <fell...@gmail.com> wrote:
>>>>
>>>> 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'
>>>> Blog: http://fhbash.wordpress.com/
>>>> GitHub: https://github.com/fellipeh
>>>> 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+unsubscribe@googlegroups.com.
>> To post to this group, send email to django-users@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.
>
>
> --
> 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+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@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/CAF1jwZHxHWPr5nX59m2N_hRzRc4rs%3DOs_%3DBk3sHtUNGWiKQtKQ%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CANQX6Cv83sW93dDsYTk_5hpwa3EFEMHPFEhXS_rnuwz-0w2oPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment