File: __init__.py

package info (click to toggle)
django-polymorphic 4.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 892 kB
  • sloc: python: 6,784; javascript: 263; makefile: 137
file content (38 lines) | stat: -rw-r--r-- 1,392 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
This allows creating formsets where each row can be a different form type.
The logic of the formsets work similar to the standard Django formsets;
there are factory methods to construct the classes with the proper form settings.

The "parent" formset hosts the entire model and their child model.
For every child type, there is an :class:`PolymorphicFormSetChild` instance
that describes how to display and construct the child.
It's parameters are very similar to the parent's factory method.
"""

from .generic import (  # Can import generic here, as polymorphic already depends on the 'contenttypes' app.
    BaseGenericPolymorphicInlineFormSet,
    GenericPolymorphicFormSetChild,
    generic_polymorphic_inlineformset_factory,
)
from .models import (
    BasePolymorphicInlineFormSet,
    BasePolymorphicModelFormSet,
    PolymorphicFormSetChild,
    UnsupportedChildType,
    polymorphic_child_forms_factory,
    polymorphic_inlineformset_factory,
    polymorphic_modelformset_factory,
)

__all__ = (
    "BasePolymorphicModelFormSet",
    "BasePolymorphicInlineFormSet",
    "PolymorphicFormSetChild",
    "UnsupportedChildType",
    "polymorphic_modelformset_factory",
    "polymorphic_inlineformset_factory",
    "polymorphic_child_forms_factory",
    "BaseGenericPolymorphicInlineFormSet",
    "GenericPolymorphicFormSetChild",
    "generic_polymorphic_inlineformset_factory",
)