Only administrators or owners of a document can move it to a target document for which they are also administrator or owner. We allow different moving modes: - first-child: move the document as the first child of the target - last-child: move the document as the last child of the target - first-sibling: move the document as the first sibling of the target - last-sibling: move the document as the last sibling of the target - left: move the document as sibling ordered just before the target - right: move the document as sibling ordered just after the target The whole subtree below the document that is being moved, moves as well and remains below the document after it is moved.
25 lines
879 B
Python
25 lines
879 B
Python
"""
|
|
Core application enums declaration
|
|
"""
|
|
|
|
from django.conf import global_settings
|
|
from django.db import models
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
# In Django's code base, `LANGUAGES` is set by default with all supported languages.
|
|
# We can use it for the choice of languages which should not be limited to the few languages
|
|
# active in the app.
|
|
# pylint: disable=no-member
|
|
ALL_LANGUAGES = {language: _(name) for language, name in global_settings.LANGUAGES}
|
|
|
|
|
|
class MoveNodePositionChoices(models.TextChoices):
|
|
"""Defines the possible positions when moving a django-treebeard node."""
|
|
|
|
FIRST_CHILD = "first-child", _("First child")
|
|
LAST_CHILD = "last-child", _("Last child")
|
|
FIRST_SIBLING = "first-sibling", _("First sibling")
|
|
LAST_SIBLING = "last-sibling", _("Last sibling")
|
|
LEFT = "left", _("Left")
|
|
RIGHT = "right", _("Right")
|