I am trying to update some ModelForm fields, these fields are not fixed. (I only tutorhave one that is autocast in view)
Model:
class Session(models.Model):
tutor = models.ForeignKey(User)
start_time = models.DateTimeField()
end_time = models.DateTimeField()
status = models.CharField(max_length=1)
the form:
class SessionForm(forms.ModelForm):
class Meta:
model = Session
exclude = ['tutor']
For this session, sometimes I need to update only end_time, and sometimes only start_time, and end_time.
How can I do this in a view?
Edit
I gave examples, but not limited to these examples, the fields that I need to update are not predefined, I need to be able to update any fields
source
share