1
In the DetailLoad
model you are setting Proveedor
ForeignKey and also making it a primary key. The primary keys are always unique that is why you can not add another entry. You need to remove the primary_key=True
from:
id_proveedor = models.ForeignKey(Proveedor,db_column='id_proveedor', primary_key=True, verbose_name='Proveedor')
In django the primary keys are automatically generated and you don’t need to define them in your models. The primary keys can be accessed with id
or pk
attribute.
Source:stackexchange.com