Closed jrgrez closed 2 years ago
This is standard django inline behavior, not specific to django-nested-admin: if a form is not considered as having changed, then it won't save. If you want to force new inlines to save, you'll need to define a custom model form and override the Form.has_changed()
method. For instance, to force saving for all new inlines, you could do something like:
class MyModelForm(forms.ModelForm):
def has_changed(self):
return not self.instance.pk or super().has_changed()
class MyModelInline(nested_admin.NestedStackedInline):
model = MyModel
form = MyModelForm
I have inlines which have default values, and not always those values need to be changed, unfortunately the admin is not recognizing these inlines as new objects, and is not saving the values into the database. Is there any way to force the data saving?