Intervention revocation
* adds Revocation model to interventions/models.py * adds revocations to interventions detail view * fixes duplicated ids in html includes * refactors controls for detail view into included template files (controls.html) * reduces max length for payment transfer notes from 1000 to 200 * adds RevocationAdmin to intervention/admin.py * adds new form for adding a Revocation to an intervention's legal_data * only one revocation per intervention possible * removes add button in case of an existing revocation * adds revocation routes to intervention app * renames document field in Document model into file for more clarity * adds/updates translations
This commit is contained in:
+17
-1
@@ -12,7 +12,7 @@ from django.utils import timezone
|
||||
from django.utils.timezone import now
|
||||
|
||||
from intervention.settings import INTERVENTION_IDENTIFIER_LENGTH, INTERVENTION_IDENTIFIER_TEMPLATE
|
||||
from konova.models import BaseObject, Geometry, UuidModel
|
||||
from konova.models import BaseObject, Geometry, UuidModel, BaseResource
|
||||
from konova.utils import generators
|
||||
from konova.utils.generators import generate_random_string
|
||||
from organisation.models import Organisation
|
||||
@@ -38,6 +38,20 @@ class ResponsibilityData(UuidModel):
|
||||
)
|
||||
|
||||
|
||||
class Revocation(BaseResource):
|
||||
"""
|
||||
Holds revocation data e.g. for intervention objects
|
||||
"""
|
||||
date = models.DateField(null=True, blank=True, help_text="Revocation from")
|
||||
comment = models.TextField(null=True, blank=True)
|
||||
document = models.ForeignKey("konova.Document", blank=True, null=True, on_delete=models.SET_NULL)
|
||||
|
||||
def delete(self):
|
||||
# Make sure related objects are being removed as well
|
||||
self.document.delete()
|
||||
super().delete()
|
||||
|
||||
|
||||
class LegalData(UuidModel):
|
||||
"""
|
||||
Holds intervention legal data such as important dates, laws or responsible handler
|
||||
@@ -51,6 +65,8 @@ class LegalData(UuidModel):
|
||||
process_type = models.CharField(max_length=500, null=True, blank=True)
|
||||
law = models.CharField(max_length=500, null=True, blank=True)
|
||||
|
||||
revocation = models.ForeignKey(Revocation, null=True, blank=True, help_text="Refers to 'Widerspruch am'", on_delete=models.SET_NULL)
|
||||
|
||||
def __str__(self):
|
||||
return "{} | {} | {}".format(
|
||||
self.process_type,
|
||||
|
||||
Reference in New Issue
Block a user