Debian Codegraph @

src/polymorphic/formsets/__init__.py

raw
1 """
2 This allows creating formsets where each row can be a different form type.
3 The logic of the formsets work similar to the standard Django formsets;
4 there are factory methods to construct the classes with the proper form settings.
5
6 The "parent" formset hosts the entire model and their child model.
7 For every child type, there is an :class:`PolymorphicFormSetChild` instance
8 that describes how to display and construct the child.
9 It's parameters are very similar to the parent's factory method.
10 """
11
12 from .generic import ( # Can import generic here, as polymorphic already depends on the 'contenttypes' app.
13 BaseGenericPolymorphicInlineFormSet,
14 GenericPolymorphicFormSetChild,
15 generic_polymorphic_inlineformset_factory,
16 )
17 from .models import (
18 BasePolymorphicInlineFormSet,
19 BasePolymorphicModelFormSet,
20 PolymorphicFormSetChild,
21 UnsupportedChildType,
22 polymorphic_child_forms_factory,
23 polymorphic_inlineformset_factory,
24 polymorphic_modelformset_factory,
25 )
26
27 __all__ = (
28 "BasePolymorphicModelFormSet",
29 "BasePolymorphicInlineFormSet",
30 "PolymorphicFormSetChild",
31 "UnsupportedChildType",
32 "polymorphic_modelformset_factory",
33 "polymorphic_inlineformset_factory",
34 "polymorphic_child_forms_factory",
35 "BaseGenericPolymorphicInlineFormSet",
36 "GenericPolymorphicFormSetChild",
37 "generic_polymorphic_inlineformset_factory",
38 )