Hello, I am trying to make a many to one relationship and want to be able to control it (add -remove etc) via the admin panel. So this is my model.py:
from django.db import models
class Office(models.Model):
name = models.CharField(max_length=30)
class Province(models.Model):
numberPlate = models.IntegerField(primary_key=True)
name = models.CharField(max_length=20)
office = models.ForeignKey(Office)
I want my model allow a province to have several Office.
So inside my admin.py:
class ProvinceCreator(admin.ModelAdmin):
list_filter = ['numberPlate']
list_display = ['name', 'numberPlate','office']
class OfficeCreator(admin.ModelAdmin):
list_display = ['name']
This seems correct to me, however when I try to add a new province with the admin panel, I get this:
TemplateSyntaxError at /admin/haritaapp/province/
Caught an exception while rendering: no such column: haritaapp_province.office_id
Thanks