I want to have a ModelForm that can create_or_update a model instance based on the request parameters.
I've been trying to cobble something together, but am realizing that my python fu is not strong enough, and the ModelForm implementation code is a quite hairy.
I found this update_or_create snipplet for working with a Model, but I think it would be incredibly useful if it were integrated with a ModelForm.
I would expect it to behave similarly to ModelForm.save():
class BetterModelForm(forms.ModelForm):
def create_or_update(self):
#magic
return (instance, created, updated)
Conversely I'd also be interested in hearing compelling reasons why this is not a good idea.