treebeard.forms.
MoveNodeForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=':', empty_permitted=False, instance=None, **kwargs)¶
Bases: django.forms.models.ModelForm
Form to handle moving a node in a tree.
Handles sorted/unsorted trees.
It adds two fields to the form:
Child of
and Sibling of
First child of
, Before
and After
Warning
Subclassing MoveNodeForm
directly is discouraged, since special care is needed to handle excluded fields, and these change depending on the tree type.
It is recommended that the movenodeform_factory()
function is used instead.
treebeard.forms.
movenodeform_factory
(model, form=<class 'treebeard.forms.MoveNodeForm'>, fields=None, exclude=None, formfield_callback=None, widgets=None)¶
Dynamically build a MoveNodeForm subclass with the proper Meta.
Parameters:Node
that will be handled by the form.MoveNodeForm
will be used.A MoveNodeForm
subclass
For a full reference of this function, please read modelform_factory()
Example, MyNode
is a subclass of treebeard.al_tree.AL_Node
:
MyNodeForm = movenodeform_factory(MyNode)
is equivalent to:
class MyNodeForm(MoveNodeForm): class Meta: model = models.MyNode exclude = ('sib_order', 'parent')
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4