# 349 LANIS link improvements

* replaces 'dumb' link template with LANIS mapinterface support
* adds fallback default LANIS link
This commit is contained in:
2023-10-25 10:04:56 +02:00
parent bfa893a02f
commit 16fd7a3a2c
9 changed files with 105 additions and 32 deletions

View File

@@ -14,7 +14,9 @@ from django.urls import reverse
from django.utils import timezone
from analysis.settings import LKOMPVZVO_PUBLISH_DATE
from intervention.settings import INTERVENTION_IDENTIFIER_LENGTH, INTERVENTION_IDENTIFIER_TEMPLATE
from intervention.settings import INTERVENTION_IDENTIFIER_LENGTH, INTERVENTION_IDENTIFIER_TEMPLATE, \
INTERVENTION_LANIS_LAYER_NAME_RECORDED, INTERVENTION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY, \
INTERVENTION_LANIS_LAYER_NAME_UNRECORDED
from intervention.tasks import celery_export_to_egon
from user.models import User
from django.db import models, transaction
@@ -383,6 +385,27 @@ class Intervention(BaseObject,
self.mark_as_edited(user, request=form.request, edit_comment=PAYMENT_REMOVED)
self.send_data_to_egon()
def get_lanis_layer_name(self):
""" Getter for specific LANIS/WFS object layer
Returns:
"""
retval = None
if self.is_recorded:
retval = INTERVENTION_LANIS_LAYER_NAME_RECORDED
else:
try:
is_old_entry = self.legal.binding_date < LKOMPVZVO_PUBLISH_DATE
except TypeError:
is_old_entry = True
if is_old_entry:
retval = INTERVENTION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY
else:
retval = INTERVENTION_LANIS_LAYER_NAME_UNRECORDED
return retval
class InterventionDocument(AbstractDocument):
"""