Can somebody explain the differences and/or similarities between save_form and save_formset from ModelAdmin?
The only things i could find about this is from source code.
def save_form(self, request, form, change):
"""
Given a ModelForm return an unsaved instance. ``change`` is True if
the object is being changed, and False if it's being added.
"""
return form.save(commit=False)
def save_formset(self, request, form, formset, change):
"""
Given an inline formset save it to the database.
"""
formset.save()
And the docs have only this about save_formset (https://docs.djangoproject.com/en/4.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_formset)
The save_formset method is given the HttpRequest, the parent ModelForm instance and a boolean value based on whether it is adding or changing the parent object.
source https://stackoverflow.com/questions/71198400/in-django-modeladmin-what-is-the-difference-between-save-form-and-save-forms
Comments
Post a Comment