konova/konova/enums.py
mipel cd5b2e264b Fixes and improvements
* moves diff_states message back to table top for direct presentation in compensation/detail/view.html
* removes diff_states rendering in deadline card in compensation/detail/view.html
* fixes before_state adding based on GET parameter
* refactors UserActionlogEntryEnum into a UserAction TextChoice (Django 3.x)
* adds ordering of compensation states depending on surface value
* refactors ServerMessageImportance from enum into TextChoice (Django 3.x)
* adds/updates translations
2021-08-03 17:22:41 +02:00

41 lines
792 B
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