konova/konova/enums.py
mipel 881edaeba6 Compensation detail view
* adds compensation detail view (WIP)
* adds includes dir for related objects, similar to interventions
* adds functionality for
   * adding/removing before_states
   * adding/removing after_states
   * adding/removing deadlines
   * adding/removing documents
* refactors usage of BaseModalForm
   * holds now process_request() in base class for generic usage anywhere
* adds __str__() method for some models
* compensation__action is blank=True now
* renamed tooltips
* adds new routes for state/deadline/document handling inside of compensation/urls.py
* adds precalculation of before/after_states for detail view, so users will see directly if there are missing states
* removes unnecessary link for intervention detail payment
* adds missing tooltips for check and record icon on detail views
* refactors DeadlineTypeEnum into DeadlineType in konova/models.py, just as the django 3.x documentation suggests for model enumerations
* UuidModel id field is not editable anymore in the admin interface
* adds/updates translations
2021-08-03 13:13:01 +02:00

59 lines
1.2 KiB
Python

"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 17.11.20
"""
from enum import Enum
class BaseEnum(Enum):
""" Provides basic functionality for Enums
"""
@classmethod
def as_choices(cls, drop_empty_choice: bool = False):
empty_choice = [] if drop_empty_choice else [(None, "---")]
choices = empty_choice + [(enum.value, enum.name) for enum in cls]
return choices
class UnitEnum(BaseEnum):
"""
Predefines units for selection
"""
mm = "mm"
dm = "dm"
cm = "cm"
m = "m"
km = "km"
qmm = "qmm"
qdm = "qdm"
qcm = "qcm"
qm = "qm"
qkm = "qkm"
ha = "ha"
st = "St." # pieces
class ServerMessageImportance(BaseEnum):
"""
Defines importance levels for server messages
"""
DEFAULT = "DEFAULT"
INFO = "INFO"
WARNING = "WARNING"
class UserActionLogEntryEnum(BaseEnum):
"""
Defines different possible user actions for UserActionLogEntry
"""
CHECKED = "Checked"
RECORDED = "Recorded"
CREATED = "Created"
DELETED = "Deleted"