#86 Parcel district column for all

* adds parcel district column for all major data objects
* adds warning about intervention-revocation on index view of compensations
* adds warning about intervention-revocation on detail view of related compensations
This commit is contained in:
2022-02-08 15:25:44 +01:00
parent a759eb2453
commit 0afb4d34c3
10 changed files with 184 additions and 65 deletions

View File

@@ -26,7 +26,7 @@ from konova.models import generate_document_file_upload_path, AbstractDocument,
RecordableObjectMixin, CheckableObjectMixin, GeoReferencedMixin
from konova.settings import LANIS_LINK_TEMPLATE, LANIS_ZOOM_LUT, DEFAULT_SRID_RLP
from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, DOCUMENT_REMOVED_TEMPLATE, \
PAYMENT_REMOVED, PAYMENT_ADDED, REVOCATION_REMOVED
PAYMENT_REMOVED, PAYMENT_ADDED, REVOCATION_REMOVED, INTERVENTION_HAS_REVOCATIONS_TEMPLATE
from user.models import UserActionLogEntry
@@ -276,6 +276,13 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec
Returns:
request (HttpRequest): The modified request
"""
# Inform user about revocation
if self.legal.revocations.exists():
messages.error(
request,
INTERVENTION_HAS_REVOCATIONS_TEMPLATE.format(self.legal.revocations.count()),
extra_tags="danger",
)
if not self.is_shared_with(request.user):
messages.info(request, DATA_UNSHARED_EXPLANATION)
request = self.set_geometry_conflict_message(request)

View File

@@ -245,14 +245,6 @@ def detail_view(request: HttpRequest, id: str):
parcels = intervention.get_underlying_parcels()
# Inform user about revocation
if intervention.legal.revocations.exists():
messages.error(
request,
_("This intervention has {} revocations").format(intervention.legal.revocations.count()),
extra_tags="danger",
)
context = {
"obj": intervention,
"compensations": compensations,