django_sorcery.formsets.base module

Helper functions for creating FormSet classes from SQLAlchemy models.

class django_sorcery.formsets.base.BaseModelFormSet(data=None, files=None, auto_id='id_%s', prefix=None, queryset=None, initial=None, **kwargs)[source]

Bases: django.forms.formsets.BaseFormSet

A FormSet for editing a queryset and/or adding new objects to it.

absolute_max = 2000
add_fields(form, index)[source]

A hook for adding extra fields on to each form instance.

delete_existing(obj, **kwargs)[source]

Deletes an existing model instance.


Returns a query for the model.


Return the number of forms that are required in this FormSet.

model = None
save(flush=True, **kwargs)[source]

Save model instances for every form, adding and changing instances as necessary, and return the list of instances.

session = None
unique_fields = {}
django_sorcery.formsets.base.modelformset_factory(model, form=<class 'django_sorcery.forms.ModelForm'>, formfield_callback=None, formset=<class 'django_sorcery.formsets.base.BaseModelFormSet'>, extra=1, can_delete=False, can_order=False, max_num=None, fields=None, exclude=None, widgets=None, validate_max=False, localized_fields=None, labels=None, help_texts=None, error_messages=None, min_num=None, validate_min=False, field_classes=None, session=None)[source]

Return a FormSet class for the given sqlalchemy model class.