7👍
✅
You need to set the on_delete parameter.
In your case :
information = models.ForeignKey(RefereeLevel,related_name='information',blank=False,null=True,default=1, on_delete=models.SET_NULL
1👍
What you can do is to set on_delete param like
information = models.ForeignKey(RefereeLevel,related_name='information',blank=False,null=True,default=1, on_delete=models.SET_NULL)
on_delete=models.SET_NULL
will set the foreign key value to null
- [Django]-In Django, how do you construct a formset manually in a template?
- [Django]-How to create different objects depending on input?
- [Django]-Django Many to Many in template
Source:stackexchange.com