i have a ModelForm that i use as the form_class for both of the views.
in both cases i need to update a different model before i save the object of
the views. i.e. i use the views to create/update model A and i need to update
model B based on the A object.
my problems are:
- in the model form i don't know if it create or update in the save method
- i don't know the old values of the fields in case of an update
anyone know how i can solve this?
update:
class updateA(UpdateView):
model = A
form_class = AForm
class createA(CreateView):
model = A
form_class = AForm
class AForm(ModelForm):
a = super(AForm, self).save(commit=False)
if commit:
a.save()
return log