Multiple foreign Field

20 views
Skip to first unread message

Kivai Muinde

unread,
Oct 12, 2019, 2:20:30 PM10/12/19
to Django users
I have two model classes, *school* and *profile*.
The school model contains a field called school_level which has several choices( primary, secondary , college,university).

The profile models has four differnt fields (school_primary, school_secondary, school_college,school_university) each is a foreign key to the school_level in the school class.

Django, however raises an error when I try makemigrations. Does any one have an idea on how to implement multiple foreign field at the same time.

Rohit Kurangi

unread,
Oct 13, 2019, 2:50:48 AM10/13/19
to django...@googlegroups.com
1) apply the python manage. py migrate --fake

2) python manage. py makemigrations and after apply the migrate

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c2c2663e-9025-4751-b5c2-5a497ce8a730%40googlegroups.com.

Salim Kachemela

unread,
Oct 13, 2019, 2:51:17 AM10/13/19
to Django users
Is it possible for you to attach a screenshot of your models.py file if you don't mind?

Rajkumar Mittal

unread,
Oct 13, 2019, 10:03:39 AM10/13/19
to Django users
Can you give the code so that I can contribute to your project

lewis machilika

unread,
Oct 13, 2019, 10:03:39 AM10/13/19
to Django users
Show us how you implemented the model.py
Reply all
Reply to author
Forward
0 new messages