1👍
It sounds like your actual database is out of sync with your model. You’ll want to either drop and recreate your database using manage.py syncdb
(easiest, but you will lose the data unless you use something like fixtures to reload initial data) or use a migration tool like South to upgrade your existing database to reflect the new data model.
1👍
You can try this on the manage.py shell:
from bar import models
l=models.Location("here")
s=models.Student(name="fred",email="foo@bar.com")
e = models.Exam(place=l,taker=s,score=99.9)
which I can do with no errors… Looks good to me..
- [Answered ]-Changing Admin Templates – Django tutorial 2
- [Answered ]-Django – Get model's children when really the child has its parent's foreign key
- [Answered ]-Django profile creation, set User profile while using multiple profile types
0👍
In the admin.py
file I had inlines = [StudentsInline]
setting. This tries to enforce adding multiple Students to one exam (thinking it’s on the One side of a OneToMany relationship).
- [Answered ]-Django Rest Framework – Nested fields: Do not create but get one from existing records
- [Answered ]-How do I reset template loader cache in Django 1.9?
- [Answered ]-Django Crispy forms doesn't save when custom layout is added
Source:stackexchange.com