1π
β
You can override your form to always set the eval_sent_state
field to the value you want in the save
method, you should remove the field from the form fields though
class ClassSchoolTeacherForm(forms.ModelForm):
class Meta:
model = ClassSchool
exclude = ['eval_sent_state']
def save(self, *args, **kwargs):
self.instance.eval_sent_state_id = 2
return super().save(*args, **kwargs)
π€Iain Shelvington
- [Answered ]-How to order Django query based on the sum of a specific field grouped by another field?
Source:stackexchange.com