You can override FormSet to set up storing inline strings.
class SomeInlineFormSet(BaseInlineFormSet): def save_new(self, form, commit=True): return super(SomeInlineFormSet, self).save_new(form, commit=commit) def save_existing(self, form, instance, commit=True): return form.save(commit=commit) class SomeInline(admin.StackedInline): formset = SomeInlineFormSet
Please note that save_new() uses only the form to receive data, it does not allow ModelForm transmit data. Instead, he builds the model itself. This allows you to insert a parental relationship, since they do not exist in the form. Therefore, overriding form.save() does not work.
For common inline strings, the form.save() method is never called, and form.cleaned_data used instead to get all the values, and Field.save_form_data() used to store the values ββin the model instance.
FYI, some general advice to understand what it is; it is really valuable to have an IDE (or perhaps a vim or Sublime setup configuration) that makes it easy to get to symbolic definitions. The above code was computed by entering inline / formet code and seeing what happens. In the case of PyCharm, which works by holding Command (or Ctrl) and clicking on a character. If you are a vim user, ctags can do something similar for you.
vdboor
source share