Konova code improvements
* improves rendering of codes as string (short names will be used if existing) * reduces selectable konova codes to leafs (as discussed with experts) * automatically resizes the width of modal form fields to w-100 * adds/updates translations
This commit is contained in:
+14
-3
@@ -11,6 +11,7 @@ from django.core.validators import MinValueValidator
|
||||
from django.db.models import Sum
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from codelist.models import KonovaCode
|
||||
from intervention.models import Intervention, ResponsibilityData
|
||||
from konova.models import BaseObject, BaseResource, Geometry, UuidModel
|
||||
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE
|
||||
@@ -22,7 +23,7 @@ class Payment(BaseResource):
|
||||
Holds data on a payment for an intervention (alternative to a classic compensation)
|
||||
"""
|
||||
amount = models.FloatField(validators=[MinValueValidator(limit_value=0.00)])
|
||||
due_on = models.DateField(null=True)
|
||||
due_on = models.DateField(null=True, blank=True)
|
||||
comment = models.CharField(
|
||||
max_length=1000,
|
||||
null=True,
|
||||
@@ -42,7 +43,12 @@ class CompensationState(UuidModel):
|
||||
"""
|
||||
Compensations must define the state of an area before and after the compensation.
|
||||
"""
|
||||
biotope_type = models.CharField(max_length=500, null=True, blank=True)
|
||||
biotope_type = models.ForeignKey(
|
||||
KonovaCode,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True
|
||||
)
|
||||
surface = models.FloatField()
|
||||
|
||||
def __str__(self):
|
||||
@@ -65,7 +71,12 @@ class CompensationAction(BaseResource):
|
||||
"""
|
||||
Compensations include actions like planting trees, refreshing rivers and so on.
|
||||
"""
|
||||
action_type = models.CharField(max_length=500, null=True, blank=True)
|
||||
action_type = models.ForeignKey(
|
||||
KonovaCode,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True
|
||||
)
|
||||
amount = models.FloatField()
|
||||
unit = models.CharField(max_length=100, null=True, blank=True, choices=UnitChoices.choices)
|
||||
comment = models.TextField(blank=True, null=True, help_text="Additional comment")
|
||||
|
||||
Reference in New Issue
Block a user