Refactoring
* splits compensation/models.py into subpackage * renames base objects by adding suffix Mixin
This commit is contained in:
36
compensation/models/state.py
Normal file
36
compensation/models/state.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 16.11.21
|
||||
|
||||
"""
|
||||
from django.db import models
|
||||
|
||||
from codelist.models import KonovaCode
|
||||
from codelist.settings import CODELIST_BIOTOPES_ID
|
||||
from compensation.managers import CompensationStateManager
|
||||
from konova.models import UuidModel
|
||||
|
||||
|
||||
class CompensationState(UuidModel):
|
||||
"""
|
||||
Compensations must define the state of an area before and after the compensation.
|
||||
"""
|
||||
biotope_type = models.ForeignKey(
|
||||
KonovaCode,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
limit_choices_to={
|
||||
"code_lists__in": [CODELIST_BIOTOPES_ID],
|
||||
"is_selectable": True,
|
||||
"is_archived": False,
|
||||
}
|
||||
)
|
||||
surface = models.FloatField()
|
||||
|
||||
objects = CompensationStateManager()
|
||||
|
||||
def __str__(self):
|
||||
return "{} | {} m²".format(self.biotope_type, self.surface)
|
||||
Reference in New Issue
Block a user