Compare commits
84 Commits
1.9.1
...
a86d86b731
| Author | SHA1 | Date | |
|---|---|---|---|
| a86d86b731 | |||
| 73178b3fd2 | |||
| 278a951e92 | |||
| 9e4a78ec60 | |||
| d03b714fb5 | |||
| a9b402862b | |||
| 61ec9c8c9b | |||
| f2baa054bf | |||
| 242730435e | |||
| afbdf221c3 | |||
| be9f6f1b7e | |||
| 80e8925a63 | |||
| c597e1934b | |||
| a44d8658d4 | |||
| bb71c0fcc8 | |||
| 67acddf701 | |||
| 21bb988d86 | |||
| 1ceffccd40 | |||
| e5db7f6b13 | |||
| 442f3ceb37 | |||
| cd2949fc03 | |||
| 7bcd32fd7a | |||
| 97f1882698 | |||
| 55cc8eb1f3 | |||
| d6cabd5f6c | |||
| 63a824f9d9 | |||
| a12c2fb57e | |||
| 23bc79ee3b | |||
| 07bac26a58 | |||
| d01816cf71 | |||
| f543dfc1cb | |||
| 62fc019127 | |||
| c01518b675 | |||
| f57306eb72 | |||
| c2b12649b0 | |||
| 6fe67a8fbf | |||
| b38a266bea | |||
| 15f86e866b | |||
| c85b136f0a | |||
| faf8aed777 | |||
| 94c498866f | |||
| 616965c890 | |||
| e39c7eb51f | |||
| 19bd408fbd | |||
| 7bfe6a37f8 | |||
| 9b63307f01 | |||
| 123a470006 | |||
| 5a0c5285e7 | |||
| 3a01eaff92 | |||
| 2af91aa178 | |||
| 53d0af89ac | |||
| 7b5c1f0d97 | |||
| ef076c0b3b | |||
| 72a5075f3b | |||
| d677ac6b5a | |||
| 9149e4cbd3 | |||
| 1c24cbea26 | |||
|
|
bc9cc09372 | ||
| 24518465f3 | |||
| 457548da4d | |||
| fa89bbba99 | |||
| 78eb711057 | |||
| 6ff67d12c9 | |||
| 3c1cbcd0bd | |||
| 416ad8478c | |||
| 6b28c4ec15 | |||
| 46a2a4ff46 | |||
| 90e5cf5b36 | |||
| 50f46e319c | |||
| e2ea087c4e | |||
| a6e43b044b | |||
| be0d261e81 | |||
| 62e1b046c3 | |||
| 669a12410f | |||
| dd77e6c16e | |||
| 33774ce557 | |||
| dc3dc99b3d | |||
| 315f9de958 | |||
| 0726c15086 | |||
| 2492a8abe8 | |||
| dbc5cba5d7 | |||
| c8948ddaea | |||
| 5039da28aa | |||
| 4567339570 |
@@ -24,6 +24,7 @@ DEFAULT_FROM_EMAIL=service@ksp.de
|
|||||||
|
|
||||||
# Proxy
|
# Proxy
|
||||||
PROXY=CHANGE_ME
|
PROXY=CHANGE_ME
|
||||||
|
MAP_PROXY_HOST_WHITELIST=CHANGE_ME_1,CHANGE_ME_2
|
||||||
GEOPORTAL_RLP_USER=CHANGE_ME
|
GEOPORTAL_RLP_USER=CHANGE_ME
|
||||||
GEOPORTAL_RLP_PASSWORD=CHANGE_ME
|
GEOPORTAL_RLP_PASSWORD=CHANGE_ME
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ SSO_SERVER_BASE_URL=https://login.naturschutz.rlp.de
|
|||||||
OAUTH_CODE_VERIFIER=CHANGE_ME
|
OAUTH_CODE_VERIFIER=CHANGE_ME
|
||||||
OAUTH_CLIENT_ID=CHANGE_ME
|
OAUTH_CLIENT_ID=CHANGE_ME
|
||||||
OAUTH_CLIENT_SECRET=CHANGE_ME
|
OAUTH_CLIENT_SECRET=CHANGE_ME
|
||||||
|
PROPAGATION_SECRET=CHANGE_ME
|
||||||
|
|
||||||
# RabbitMQ
|
# RabbitMQ
|
||||||
## For connections to EGON
|
## For connections to EGON
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class APIUserToken(models.Model):
|
|||||||
if token_obj.valid_until is not None and token_obj.valid_until < _today:
|
if token_obj.valid_until is not None and token_obj.valid_until < _today:
|
||||||
raise PermissionError("Token validity expired")
|
raise PermissionError("Token validity expired")
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
raise PermissionError("Credentials invalid")
|
raise PermissionError("Token unknown")
|
||||||
return token_obj.user
|
return token_obj.user
|
||||||
|
|
||||||
|
|
||||||
@@ -155,3 +155,25 @@ class OAuthToken(UuidModel):
|
|||||||
|
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
def revoke(self) -> int:
|
||||||
|
""" Revokes the OAuth2 token of the user
|
||||||
|
|
||||||
|
(/o/revoke_token/ indeed removes the corresponding access token on provider side and invalidates the
|
||||||
|
submitted refresh token in one step)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
revocation_status_code (int): HTTP status code for revocation of refresh_token
|
||||||
|
"""
|
||||||
|
revoke_url = f"{SSO_SERVER_BASE}o/revoke_token/"
|
||||||
|
token = self.refresh_token
|
||||||
|
revocation_status_code = requests.post(
|
||||||
|
revoke_url,
|
||||||
|
data={
|
||||||
|
'token': token,
|
||||||
|
'token_type_hint': "refresh_token",
|
||||||
|
},
|
||||||
|
auth=(OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET),
|
||||||
|
).status_code
|
||||||
|
|
||||||
|
return revocation_status_code
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ from django.contrib.gis import geos
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from api.tests.v1.share.test_api_sharing import BaseAPIV1TestCase
|
from api.tests.v1.share.test_api_sharing import BaseAPIV1TestCase
|
||||||
from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP
|
from konova.models import Geometry
|
||||||
|
|
||||||
|
|
||||||
class APIV1UpdateTestCase(BaseAPIV1TestCase):
|
class APIV1UpdateTestCase(BaseAPIV1TestCase):
|
||||||
@@ -64,7 +64,7 @@ class APIV1UpdateTestCase(BaseAPIV1TestCase):
|
|||||||
|
|
||||||
put_props = put_body["properties"]
|
put_props = put_body["properties"]
|
||||||
put_geom = geos.fromstr(json.dumps(put_body))
|
put_geom = geos.fromstr(json.dumps(put_body))
|
||||||
put_geom.transform(DEFAULT_SRID_RLP)
|
put_geom = Geometry.cast_to_rlp_srid(put_geom)
|
||||||
self.assertEqual(put_geom, self.intervention.geometry.geom)
|
self.assertEqual(put_geom, self.intervention.geometry.geom)
|
||||||
self.assertEqual(put_props["title"], self.intervention.title)
|
self.assertEqual(put_props["title"], self.intervention.title)
|
||||||
self.assertNotEqual(modified_on, self.intervention.modified)
|
self.assertNotEqual(modified_on, self.intervention.modified)
|
||||||
@@ -94,7 +94,7 @@ class APIV1UpdateTestCase(BaseAPIV1TestCase):
|
|||||||
|
|
||||||
put_props = put_body["properties"]
|
put_props = put_body["properties"]
|
||||||
put_geom = geos.fromstr(json.dumps(put_body))
|
put_geom = geos.fromstr(json.dumps(put_body))
|
||||||
put_geom.transform(DEFAULT_SRID_RLP)
|
put_geom = Geometry.cast_to_rlp_srid(put_geom)
|
||||||
self.assertEqual(put_geom, self.compensation.geometry.geom)
|
self.assertEqual(put_geom, self.compensation.geometry.geom)
|
||||||
self.assertEqual(put_props["title"], self.compensation.title)
|
self.assertEqual(put_props["title"], self.compensation.title)
|
||||||
self.assertNotEqual(modified_on, self.compensation.modified)
|
self.assertNotEqual(modified_on, self.compensation.modified)
|
||||||
@@ -124,7 +124,7 @@ class APIV1UpdateTestCase(BaseAPIV1TestCase):
|
|||||||
|
|
||||||
put_props = put_body["properties"]
|
put_props = put_body["properties"]
|
||||||
put_geom = geos.fromstr(json.dumps(put_body))
|
put_geom = geos.fromstr(json.dumps(put_body))
|
||||||
put_geom.transform(DEFAULT_SRID_RLP)
|
put_geom = Geometry.cast_to_rlp_srid(put_geom)
|
||||||
self.assertEqual(put_geom, self.eco_account.geometry.geom)
|
self.assertEqual(put_geom, self.eco_account.geometry.geom)
|
||||||
self.assertEqual(put_props["title"], self.eco_account.title)
|
self.assertEqual(put_props["title"], self.eco_account.title)
|
||||||
self.assertNotEqual(modified_on, self.eco_account.modified)
|
self.assertNotEqual(modified_on, self.eco_account.modified)
|
||||||
@@ -156,7 +156,7 @@ class APIV1UpdateTestCase(BaseAPIV1TestCase):
|
|||||||
|
|
||||||
put_props = put_body["properties"]
|
put_props = put_body["properties"]
|
||||||
put_geom = geos.fromstr(json.dumps(put_body))
|
put_geom = geos.fromstr(json.dumps(put_body))
|
||||||
put_geom.transform(DEFAULT_SRID_RLP)
|
put_geom = Geometry.cast_to_rlp_srid(put_geom)
|
||||||
self.assertEqual(put_geom, self.ema.geometry.geom)
|
self.assertEqual(put_geom, self.ema.geometry.geom)
|
||||||
self.assertEqual(put_props["title"], self.ema.title)
|
self.assertEqual(put_props["title"], self.ema.title)
|
||||||
self.assertNotEqual(modified_on, self.ema.modified)
|
self.assertNotEqual(modified_on, self.ema.modified)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from django.contrib.gis.geos import GEOSGeometry
|
|||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP
|
from konova.models import Geometry
|
||||||
from konova.utils.message_templates import DATA_UNSHARED
|
from konova.utils.message_templates import DATA_UNSHARED
|
||||||
|
|
||||||
|
|
||||||
@@ -145,8 +145,8 @@ class AbstractModelAPISerializer:
|
|||||||
if isinstance(geojson, dict):
|
if isinstance(geojson, dict):
|
||||||
geojson = json.dumps(geojson)
|
geojson = json.dumps(geojson)
|
||||||
geometry = geos.fromstr(geojson)
|
geometry = geos.fromstr(geojson)
|
||||||
if geometry.srid != DEFAULT_SRID_RLP:
|
geometry = Geometry.cast_to_rlp_srid(geometry)
|
||||||
geometry.transform(DEFAULT_SRID_RLP)
|
geometry = Geometry.cast_to_multipolygon(geometry)
|
||||||
return geometry
|
return geometry
|
||||||
|
|
||||||
def _get_obj_from_db(self, id, user):
|
def _get_obj_from_db(self, id, user):
|
||||||
|
|||||||
@@ -50,14 +50,19 @@ class AbstractAPIView(View):
|
|||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
# Fetch the proper user from the given request header token
|
# Fetch the proper user from the given request header token
|
||||||
ksp_token = request.headers.get(KSP_TOKEN_HEADER_IDENTIFIER, None)
|
token = request.headers.get(KSP_TOKEN_HEADER_IDENTIFIER, None)
|
||||||
ksp_user = request.headers.get(KSP_USER_HEADER_IDENTIFIER, None)
|
ksp_user = request.headers.get(KSP_USER_HEADER_IDENTIFIER, None)
|
||||||
token_user = APIUserToken.get_user_from_token(ksp_token)
|
|
||||||
|
|
||||||
if ksp_user != token_user.username:
|
if not token and not ksp_user:
|
||||||
|
bearer_token = request.headers.get("authorization", None)
|
||||||
|
if not bearer_token:
|
||||||
|
raise PermissionError("No token provided")
|
||||||
|
token = bearer_token.split(" ")[1]
|
||||||
|
|
||||||
|
token_user = APIUserToken.get_user_from_token(token)
|
||||||
|
if ksp_user and ksp_user != token_user.username:
|
||||||
raise PermissionError(f"Invalid token for {ksp_user}")
|
raise PermissionError(f"Invalid token for {ksp_user}")
|
||||||
else:
|
self.user = token_user
|
||||||
self.user = token_user
|
|
||||||
|
|
||||||
request.user = self.user
|
request.user = self.user
|
||||||
if not self.user.is_default_user():
|
if not self.user.is_default_user():
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ class Command(BaseKonovaCommand):
|
|||||||
atom_id = element.find("atomid").text
|
atom_id = element.find("atomid").text
|
||||||
selectable = element.find("selectable").text.lower()
|
selectable = element.find("selectable").text.lower()
|
||||||
selectable = bool_map.get(selectable, False)
|
selectable = bool_map.get(selectable, False)
|
||||||
short_name = element.find("shortname").text
|
short_name = element.find("shortname").text or ""
|
||||||
long_name = element.find("longname").text
|
long_name = element.find("longname").text or ""
|
||||||
is_archived = bool_map.get((element.find("archive").text.lower()), False)
|
is_archived = bool_map.get((element.find("archive").text.lower()), False)
|
||||||
|
|
||||||
code = KonovaCode.objects.get_or_create(
|
code = KonovaCode.objects.get_or_create(
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# Generated by Django 5.0.7 on 2024-08-06 13:40
|
# Generated by Django 5.0.7 on 2024-08-06 13:40
|
||||||
|
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
@@ -10,9 +11,12 @@ def migrate_975_to_288(apps, schema_editor):
|
|||||||
KonovaCodeList = apps.get_model('codelist', 'KonovaCodeList')
|
KonovaCodeList = apps.get_model('codelist', 'KonovaCodeList')
|
||||||
CompensationState = apps.get_model('compensation', 'CompensationState')
|
CompensationState = apps.get_model('compensation', 'CompensationState')
|
||||||
|
|
||||||
list_288 = KonovaCodeList.objects.get(
|
try:
|
||||||
id=CODELIST_BIOTOPES_EXTRA_CODES_FULL_ID
|
list_288 = KonovaCodeList.objects.get(
|
||||||
).codes.all()
|
id=CODELIST_BIOTOPES_EXTRA_CODES_FULL_ID
|
||||||
|
).codes.all()
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
raise AssertionError("KonovaCodeList 288 does not exist. Did you run 'update_codelist' before migrating?")
|
||||||
|
|
||||||
states_with_extra_code = CompensationState.objects.filter(
|
states_with_extra_code = CompensationState.objects.filter(
|
||||||
~Q(biotope_type_details=None)
|
~Q(biotope_type_details=None)
|
||||||
@@ -42,8 +46,15 @@ class Migration(migrations.Migration):
|
|||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('codelist', '0001_initial'),
|
('codelist', '0001_initial'),
|
||||||
|
('compensation', '0003_auto_20220202_0846'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
# If migration of codelist is not necessary, this variable can shut down the logic whilst not disturbing the
|
||||||
migrations.RunPython(migrate_975_to_288)
|
# migration history
|
||||||
]
|
EXECUTE_CODELIST_MIGRATION = True
|
||||||
|
|
||||||
|
operations = []
|
||||||
|
|
||||||
|
if EXECUTE_CODELIST_MIGRATION:
|
||||||
|
operations.append(migrations.RunPython(migrate_975_to_288))
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# Generated by Django 5.0.8 on 2024-08-26 16:47
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('codelist', '0002_migrate_975_to_288'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='konovacode',
|
||||||
|
name='long_name',
|
||||||
|
field=models.CharField(blank=True, default="", max_length=1000),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='konovacode',
|
||||||
|
name='short_name',
|
||||||
|
field=models.CharField(blank=True, default="", help_text='Short version of long name', max_length=500),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -168,6 +168,17 @@ class NewCompensationForm(AbstractCompensationForm,
|
|||||||
comp.log.add(action)
|
comp.log.add(action)
|
||||||
return comp, action
|
return comp, action
|
||||||
|
|
||||||
|
def is_valid(self):
|
||||||
|
valid = super().is_valid()
|
||||||
|
intervention = self.cleaned_data.get("intervention", None)
|
||||||
|
valid &= not intervention.is_recorded
|
||||||
|
if not valid:
|
||||||
|
self.add_error(
|
||||||
|
"intervention",
|
||||||
|
_("This intervention is currently recorded. You cannot add further compensations as long as it is recorded.")
|
||||||
|
)
|
||||||
|
return valid
|
||||||
|
|
||||||
def save(self, user: User, geom_form: SimpleGeomForm):
|
def save(self, user: User, geom_form: SimpleGeomForm):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
comp, action = self.__create_comp(user)
|
comp, action = self.__create_comp(user)
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 5.0.8 on 2024-08-26 16:47
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('codelist', '0003_alter_konovacode_long_name_and_more'),
|
||||||
|
('compensation', '0015_alter_compensation_after_states_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='compensationstate',
|
||||||
|
name='biotope_type_details',
|
||||||
|
field=models.ManyToManyField(blank=True, limit_choices_to={'code_lists__in': [288], 'is_archived': False, 'is_selectable': True}, related_name='+', to='codelist.konovacode'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-action' obj.id %}" title="{% trans 'Add new action' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-action' obj.id %}" title="{% trans 'Add new action' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'seedling' %}
|
{% fa5_icon 'seedling' %}
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Comment' %}
|
{% trans 'Comment' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:action-edit' obj.id action.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit action' %}">
|
<button data-form-url="{% url 'compensation:action-edit' obj.id action.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit action' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
{% fa5_icon 'file-alt' %}
|
{% fa5_icon 'file-alt' %}
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
{% if has_access %}
|
{% if is_entry_shared %}
|
||||||
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Resubmission' %}" data-form-url="{% url 'compensation:resubmission-create' obj.id %}">
|
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Resubmission' %}" data-form-url="{% url 'compensation:resubmission-create' obj.id %}">
|
||||||
{% fa5_icon 'bell' %}
|
{% fa5_icon 'bell' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-deadline' obj.id %}" title="{% trans 'Add new deadline' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-deadline' obj.id %}" title="{% trans 'Add new deadline' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'calendar-check' %}
|
{% fa5_icon 'calendar-check' %}
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Comment' %}
|
{% trans 'Comment' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:deadline-edit' obj.id deadline.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit deadline' %}">
|
<button data-form-url="{% url 'compensation:deadline-edit' obj.id deadline.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit deadline' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'file' %}
|
{% fa5_icon 'file' %}
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Comment' %}
|
{% trans 'Comment' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:edit-doc' obj.id doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit document' %}">
|
<button data-form-url="{% url 'compensation:edit-doc' obj.id doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit document' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-state' obj.id %}" title="{% trans 'Add new state after' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-state' obj.id %}" title="{% trans 'Add new state after' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'layer-group' %}
|
{% fa5_icon 'layer-group' %}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Surface' %}
|
{% trans 'Surface' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ state.surface|floatformat:2 }} m²</td>
|
<td>{{ state.surface|floatformat:2 }} m²</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
<button data-form-url="{% url 'compensation:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-state' obj.id %}?before=true" title="{% trans 'Add new state before' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:new-state' obj.id %}?before=true" title="{% trans 'Add new state before' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'layer-group' %}
|
{% fa5_icon 'layer-group' %}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Surface' %}
|
{% trans 'Surface' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ state.surface|floatformat:2 }} m²</td>
|
<td>{{ state.surface|floatformat:2 }} m²</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
<button data-form-url="{% url 'compensation:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -123,7 +123,7 @@
|
|||||||
{% include 'user/includes/team_data_modal_button.html' %}
|
{% include 'user/includes/team_data_modal_button.html' %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<hr>
|
<hr>
|
||||||
{% if has_access %}
|
{% if is_entry_shared %}
|
||||||
{% for user in obj.intervention.shared_users %}
|
{% for user in obj.intervention.shared_users %}
|
||||||
{% include 'user/includes/contact_modal_button.html' %}
|
{% include 'user/includes/contact_modal_button.html' %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-action' obj.id %}" title="{% trans 'Add new action' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-action' obj.id %}" title="{% trans 'Add new action' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'seedling' %}
|
{% fa5_icon 'seedling' %}
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Comment' %}
|
{% trans 'Comment' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:acc:action-edit' obj.id action.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit action' %}">
|
<button data-form-url="{% url 'compensation:acc:action-edit' obj.id action.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit action' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
{% fa5_icon 'file-alt' %}
|
{% fa5_icon 'file-alt' %}
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
{% if has_access %}
|
{% if is_entry_shared %}
|
||||||
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Resubmission' %}" data-form-url="{% url 'compensation:acc:resubmission-create' obj.id %}">
|
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Resubmission' %}" data-form-url="{% url 'compensation:acc:resubmission-create' obj.id %}">
|
||||||
{% fa5_icon 'bell' %}
|
{% fa5_icon 'bell' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-deadline' obj.id %}" title="{% trans 'Add new deadline' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-deadline' obj.id %}" title="{% trans 'Add new deadline' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'calendar-check' %}
|
{% fa5_icon 'calendar-check' %}
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:acc:deadline-edit' obj.id deadline.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit deadline' %}">
|
<button data-form-url="{% url 'compensation:acc:deadline-edit' obj.id deadline.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit deadline' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
<td class="align-middle">{{ deduction.surface|floatformat:2|intcomma }} m²</td>
|
<td class="align-middle">{{ deduction.surface|floatformat:2|intcomma }} m²</td>
|
||||||
<td class="align-middle">{{ deduction.created.timestamp|default_if_none:""|naturalday}}</td>
|
<td class="align-middle">{{ deduction.created.timestamp|default_if_none:""|naturalday}}</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access or is_default_member and user in deduction.intervention.shared_users %}
|
{% if is_default_member and is_entry_shared or is_default_member and user in deduction.intervention.shared_users %}
|
||||||
<button data-form-url="{% url 'compensation:acc:edit-deduction' deduction.account.id deduction.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit Deduction' %}">
|
<button data-form-url="{% url 'compensation:acc:edit-deduction' deduction.account.id deduction.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit Deduction' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'file' %}
|
{% fa5_icon 'file' %}
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:acc:edit-doc' obj.id doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit document' %}">
|
<button data-form-url="{% url 'compensation:acc:edit-doc' obj.id doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit document' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-state' obj.id %}" title="{% trans 'Add new state after' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-state' obj.id %}" title="{% trans 'Add new state after' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'layer-group' %}
|
{% fa5_icon 'layer-group' %}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Surface' %}
|
{% trans 'Surface' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ state.surface|floatformat:2 }} m²</td>
|
<td>{{ state.surface|floatformat:2 }} m²</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:acc:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
<button data-form-url="{% url 'compensation:acc:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-state' obj.id %}?before=true" title="{% trans 'Add new state before' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-state' obj.id %}?before=true" title="{% trans 'Add new state before' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'layer-group' %}
|
{% fa5_icon 'layer-group' %}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Surface' %}
|
{% trans 'Surface' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ state.surface|floatformat:2 }} m²</td>
|
<td>{{ state.surface|floatformat:2 }} m²</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:acc:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
<button data-form-url="{% url 'compensation:acc:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
{% include 'user/includes/team_data_modal_button.html' %}
|
{% include 'user/includes/team_data_modal_button.html' %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<hr>
|
<hr>
|
||||||
{% if has_access %}
|
{% if is_entry_shared %}
|
||||||
{% for user in obj.users.all %}
|
{% for user in obj.users.all %}
|
||||||
{% include 'user/includes/contact_modal_button.html' %}
|
{% include 'user/includes/contact_modal_button.html' %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
post_data = {
|
post_data = {
|
||||||
"identifier": test_id,
|
"identifier": test_id,
|
||||||
"title": test_title,
|
"title": test_title,
|
||||||
"geom": geom_json,
|
"output": geom_json,
|
||||||
"intervention": self.intervention.id,
|
"intervention": self.intervention.id,
|
||||||
}
|
}
|
||||||
pre_creation_intervention_log_count = self.intervention.log.count()
|
pre_creation_intervention_log_count = self.intervention.log.count()
|
||||||
@@ -94,7 +94,7 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
post_data = {
|
post_data = {
|
||||||
"identifier": test_id,
|
"identifier": test_id,
|
||||||
"title": test_title,
|
"title": test_title,
|
||||||
"geom": geom_json,
|
"output": geom_json,
|
||||||
}
|
}
|
||||||
pre_creation_intervention_log_count = self.intervention.log.count()
|
pre_creation_intervention_log_count = self.intervention.log.count()
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
"title": new_title,
|
"title": new_title,
|
||||||
"intervention": self.intervention.id, # just keep the intervention as it is
|
"intervention": self.intervention.id, # just keep the intervention as it is
|
||||||
"comment": new_comment,
|
"comment": new_comment,
|
||||||
"geom": geojson,
|
"output": geojson,
|
||||||
}
|
}
|
||||||
self.client_user.post(url, post_data)
|
self.client_user.post(url, post_data)
|
||||||
self.compensation.refresh_from_db()
|
self.compensation.refresh_from_db()
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class EcoAccountWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
post_data = {
|
post_data = {
|
||||||
"identifier": test_id,
|
"identifier": test_id,
|
||||||
"title": test_title,
|
"title": test_title,
|
||||||
"geom": geom_json,
|
"output": geom_json,
|
||||||
"surface": test_deductable_surface,
|
"surface": test_deductable_surface,
|
||||||
"conservation_office": test_conservation_office.id
|
"conservation_office": test_conservation_office.id
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ class EcoAccountWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
new_title = self.create_dummy_string()
|
new_title = self.create_dummy_string()
|
||||||
new_identifier = self.create_dummy_string()
|
new_identifier = self.create_dummy_string()
|
||||||
new_comment = self.create_dummy_string()
|
new_comment = self.create_dummy_string()
|
||||||
new_geometry = MultiPolygon(srid=4326) # Create an empty geometry
|
new_geometry = self.create_dummy_geometry()
|
||||||
test_conservation_office = self.get_conservation_office_code()
|
test_conservation_office = self.get_conservation_office_code()
|
||||||
test_deductable_surface = self.eco_account.deductable_surface + 100
|
test_deductable_surface = self.eco_account.deductable_surface + 100
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ class EcoAccountWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
"identifier": new_identifier,
|
"identifier": new_identifier,
|
||||||
"title": new_title,
|
"title": new_title,
|
||||||
"comment": new_comment,
|
"comment": new_comment,
|
||||||
"geom": new_geometry.geojson,
|
"output": self.create_geojson(new_geometry),
|
||||||
"surface": test_deductable_surface,
|
"surface": test_deductable_surface,
|
||||||
"conservation_office": test_conservation_office.id
|
"conservation_office": test_conservation_office.id
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,26 +10,27 @@ from django.urls import path
|
|||||||
from compensation.views.compensation.document import EditCompensationDocumentView, NewCompensationDocumentView, \
|
from compensation.views.compensation.document import EditCompensationDocumentView, NewCompensationDocumentView, \
|
||||||
GetCompensationDocumentView, RemoveCompensationDocumentView
|
GetCompensationDocumentView, RemoveCompensationDocumentView
|
||||||
from compensation.views.compensation.resubmission import CompensationResubmissionView
|
from compensation.views.compensation.resubmission import CompensationResubmissionView
|
||||||
from compensation.views.compensation.report import report_view
|
from compensation.views.compensation.report import CompensationReportView
|
||||||
from compensation.views.compensation.deadline import NewCompensationDeadlineView, EditCompensationDeadlineView, \
|
from compensation.views.compensation.deadline import NewCompensationDeadlineView, EditCompensationDeadlineView, \
|
||||||
RemoveCompensationDeadlineView
|
RemoveCompensationDeadlineView
|
||||||
from compensation.views.compensation.action import NewCompensationActionView, EditCompensationActionView, \
|
from compensation.views.compensation.action import NewCompensationActionView, EditCompensationActionView, \
|
||||||
RemoveCompensationActionView
|
RemoveCompensationActionView
|
||||||
from compensation.views.compensation.state import NewCompensationStateView, EditCompensationStateView, \
|
from compensation.views.compensation.state import NewCompensationStateView, EditCompensationStateView, \
|
||||||
RemoveCompensationStateView
|
RemoveCompensationStateView
|
||||||
from compensation.views.compensation.compensation import index_view, new_view, new_id_view, detail_view, edit_view, \
|
from compensation.views.compensation.compensation import \
|
||||||
remove_view
|
remove_view, CompensationIndexView, CompensationIdentifierGeneratorView, CompensationDetailView, \
|
||||||
|
NewCompensationFormView, EditCompensationFormView
|
||||||
from compensation.views.compensation.log import CompensationLogView
|
from compensation.views.compensation.log import CompensationLogView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# Main compensation
|
# Main compensation
|
||||||
path("", index_view, name="index"),
|
path("", CompensationIndexView.as_view(), name="index"),
|
||||||
path('new/id', new_id_view, name='new-id'),
|
path('new/id', CompensationIdentifierGeneratorView.as_view(), name='new-id'),
|
||||||
path('new/<intervention_id>', new_view, name='new'),
|
path('new/<intervention_id>', NewCompensationFormView.as_view(), name='new'),
|
||||||
path('new', new_view, name='new'),
|
path('new', NewCompensationFormView.as_view(), name='new'),
|
||||||
path('<id>', detail_view, name='detail'),
|
path('<id>', CompensationDetailView.as_view(), name='detail'),
|
||||||
path('<id>/log', CompensationLogView.as_view(), name='log'),
|
path('<id>/log', CompensationLogView.as_view(), name='log'),
|
||||||
path('<id>/edit', edit_view, name='edit'),
|
path('<id>/edit', EditCompensationFormView.as_view(), name='edit'),
|
||||||
path('<id>/remove', remove_view, name='remove'),
|
path('<id>/remove', remove_view, name='remove'),
|
||||||
|
|
||||||
path('<id>/state/new', NewCompensationStateView.as_view(), name='new-state'),
|
path('<id>/state/new', NewCompensationStateView.as_view(), name='new-state'),
|
||||||
@@ -43,7 +44,7 @@ urlpatterns = [
|
|||||||
path('<id>/deadline/new', NewCompensationDeadlineView.as_view(), name="new-deadline"),
|
path('<id>/deadline/new', NewCompensationDeadlineView.as_view(), name="new-deadline"),
|
||||||
path('<id>/deadline/<deadline_id>/edit', EditCompensationDeadlineView.as_view(), name='deadline-edit'),
|
path('<id>/deadline/<deadline_id>/edit', EditCompensationDeadlineView.as_view(), name='deadline-edit'),
|
||||||
path('<id>/deadline/<deadline_id>/remove', RemoveCompensationDeadlineView.as_view(), name='deadline-remove'),
|
path('<id>/deadline/<deadline_id>/remove', RemoveCompensationDeadlineView.as_view(), name='deadline-remove'),
|
||||||
path('<id>/report', report_view, name='report'),
|
path('<id>/report', CompensationReportView.as_view(), name='report'),
|
||||||
path('<id>/resub', CompensationResubmissionView.as_view(), name='resubmission-create'),
|
path('<id>/resub', CompensationResubmissionView.as_view(), name='resubmission-create'),
|
||||||
|
|
||||||
# Documents
|
# Documents
|
||||||
|
|||||||
@@ -8,11 +8,12 @@ Created on: 24.08.21
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from compensation.autocomplete.eco_account import EcoAccountAutocomplete
|
from compensation.autocomplete.eco_account import EcoAccountAutocomplete
|
||||||
from compensation.views.eco_account.eco_account import index_view, new_view, new_id_view, edit_view, remove_view, \
|
from compensation.views.eco_account.eco_account import remove_view, \
|
||||||
detail_view
|
EcoAccountIndexView, EcoAccountIdentifierGeneratorView, EcoAccountDetailView, NewEcoAccountFormView, \
|
||||||
|
EditEcoAccountFormView
|
||||||
from compensation.views.eco_account.log import EcoAccountLogView
|
from compensation.views.eco_account.log import EcoAccountLogView
|
||||||
from compensation.views.eco_account.record import EcoAccountRecordView
|
from compensation.views.eco_account.record import EcoAccountRecordView
|
||||||
from compensation.views.eco_account.report import report_view
|
from compensation.views.eco_account.report import EcoAccountReportView
|
||||||
from compensation.views.eco_account.resubmission import EcoAccountResubmissionView
|
from compensation.views.eco_account.resubmission import EcoAccountResubmissionView
|
||||||
from compensation.views.eco_account.state import NewEcoAccountStateView, EditEcoAccountStateView, \
|
from compensation.views.eco_account.state import NewEcoAccountStateView, EditEcoAccountStateView, \
|
||||||
RemoveEcoAccountStateView
|
RemoveEcoAccountStateView
|
||||||
@@ -28,14 +29,14 @@ from compensation.views.eco_account.deduction import NewEcoAccountDeductionView,
|
|||||||
|
|
||||||
app_name = "acc"
|
app_name = "acc"
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", index_view, name="index"),
|
path("", EcoAccountIndexView.as_view(), name="index"),
|
||||||
path('new/', new_view, name='new'),
|
path('new/', NewEcoAccountFormView.as_view(), name='new'),
|
||||||
path('new/id', new_id_view, name='new-id'),
|
path('new/id', EcoAccountIdentifierGeneratorView.as_view(), name='new-id'),
|
||||||
path('<id>', detail_view, name='detail'),
|
path('<id>', EcoAccountDetailView.as_view(), name='detail'),
|
||||||
path('<id>/log', EcoAccountLogView.as_view(), name='log'),
|
path('<id>/log', EcoAccountLogView.as_view(), name='log'),
|
||||||
path('<id>/record', EcoAccountRecordView.as_view(), name='record'),
|
path('<id>/record', EcoAccountRecordView.as_view(), name='record'),
|
||||||
path('<id>/report', report_view, name='report'),
|
path('<id>/report', EcoAccountReportView.as_view(), name='report'),
|
||||||
path('<id>/edit', edit_view, name='edit'),
|
path('<id>/edit', EditEcoAccountFormView.as_view(), name='edit'),
|
||||||
path('<id>/remove', remove_view, name='remove'),
|
path('<id>/remove', remove_view, name='remove'),
|
||||||
path('<id>/resub', EcoAccountResubmissionView.as_view(), name='resubmission-create'),
|
path('<id>/resub', EcoAccountResubmissionView.as_view(), name='resubmission-create'),
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ Created on: 19.08.22
|
|||||||
"""
|
"""
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.db.models import Sum
|
|
||||||
from django.http import HttpRequest, JsonResponse
|
from django.http import HttpRequest, JsonResponse
|
||||||
from django.shortcuts import get_object_or_404, render, redirect
|
from django.shortcuts import get_object_or_404, render, redirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
@@ -18,263 +18,150 @@ from compensation.forms.compensation import EditCompensationForm, NewCompensatio
|
|||||||
from compensation.models import Compensation
|
from compensation.models import Compensation
|
||||||
from compensation.tables.compensation import CompensationTable
|
from compensation.tables.compensation import CompensationTable
|
||||||
from intervention.models import Intervention
|
from intervention.models import Intervention
|
||||||
from konova.contexts import BaseContext
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
from konova.decorators import shared_access_required, default_group_required, any_group_check, login_required_modal, \
|
|
||||||
uuid_required
|
|
||||||
from konova.forms import SimpleGeomForm
|
|
||||||
from konova.forms.modals import RemoveModalForm
|
from konova.forms.modals import RemoveModalForm
|
||||||
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
|
|
||||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
|
||||||
from konova.utils.message_templates import COMPENSATION_REMOVED_TEMPLATE, DATA_CHECKED_PREVIOUSLY_TEMPLATE, \
|
from konova.utils.message_templates import COMPENSATION_REMOVED_TEMPLATE, DATA_CHECKED_PREVIOUSLY_TEMPLATE, \
|
||||||
RECORDED_BLOCKS_EDIT, CHECK_STATE_RESET, FORM_INVALID, PARAMS_INVALID, IDENTIFIER_REPLACED, \
|
RECORDED_BLOCKS_EDIT, PARAMS_INVALID
|
||||||
COMPENSATION_ADDED_TEMPLATE, DO_NOT_FORGET_TO_SHARE, GEOMETRY_SIMPLIFIED
|
from konova.views.base import BaseIndexView, BaseIdentifierGeneratorView, BaseNewSpatialLocatedObjectFormView, \
|
||||||
|
BaseEditSpatialLocatedObjectFormView
|
||||||
|
from konova.views.detail import BaseDetailView
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class CompensationIndexView(LoginRequiredMixin, BaseIndexView):
|
||||||
@any_group_check
|
_TAB_TITLE = _("Compensations - Overview")
|
||||||
def index_view(request: HttpRequest):
|
_INDEX_TABLE_CLS = CompensationTable
|
||||||
"""
|
|
||||||
Renders the index view for compensation
|
|
||||||
|
|
||||||
Args:
|
def _get_queryset(self):
|
||||||
request (HttpRequest): The incoming request
|
qs = Compensation.objects.filter(
|
||||||
|
deleted=None, # only show those which are not deleted individually
|
||||||
Returns:
|
intervention__deleted=None, # and don't show the ones whose intervention has been deleted
|
||||||
A rendered view
|
).order_by(
|
||||||
"""
|
"-modified__timestamp"
|
||||||
template = "generic_index.html"
|
)
|
||||||
compensations = Compensation.objects.filter(
|
return qs
|
||||||
deleted=None, # only show those which are not deleted individually
|
|
||||||
intervention__deleted=None, # and don't show the ones whose intervention has been deleted
|
|
||||||
).order_by(
|
|
||||||
"-modified__timestamp"
|
|
||||||
)
|
|
||||||
table = CompensationTable(
|
|
||||||
request=request,
|
|
||||||
queryset=compensations
|
|
||||||
)
|
|
||||||
context = {
|
|
||||||
"table": table,
|
|
||||||
TAB_TITLE_IDENTIFIER: _("Compensations - Overview"),
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class NewCompensationFormView(BaseNewSpatialLocatedObjectFormView):
|
||||||
@default_group_required
|
_FORM_CLS = NewCompensationForm
|
||||||
@shared_access_required(Intervention, "intervention_id")
|
_MODEL_CLS = Compensation
|
||||||
def new_view(request: HttpRequest, intervention_id: str = None):
|
_TEMPLATE = "compensation/form/view.html"
|
||||||
"""
|
_TAB_TITLE = _("New Compensation")
|
||||||
Renders a view for a new compensation creation
|
_REDIRECT_URL = "compensation:detail"
|
||||||
|
|
||||||
Args:
|
def _user_has_shared_access(self, user, **kwargs):
|
||||||
request (HttpRequest): The incoming request
|
# On a new compensation make sure the intervention (if call came directly through an intervention's detail
|
||||||
|
# view) is shared with the user
|
||||||
|
intervention_id = kwargs.get("intervention_id", None)
|
||||||
|
if not intervention_id:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
intervention = get_object_or_404(Intervention, id=intervention_id)
|
||||||
|
return intervention.is_shared_with(user)
|
||||||
|
|
||||||
Returns:
|
def _user_has_permission(self, user):
|
||||||
|
# User has to be an ets user
|
||||||
|
return user.is_default_user()
|
||||||
|
|
||||||
"""
|
def dispatch(self, request, *args, **kwargs):
|
||||||
template = "compensation/form/view.html"
|
# Make sure there is an existing intervention based on the given id
|
||||||
if intervention_id is not None:
|
# Compensations can not exist without an intervention
|
||||||
try:
|
intervention_id = kwargs.get("intervention_id", None)
|
||||||
intervention = Intervention.objects.get(id=intervention_id)
|
if intervention_id:
|
||||||
except ObjectDoesNotExist:
|
try:
|
||||||
messages.error(request, PARAMS_INVALID)
|
intervention = Intervention.objects.get(id=intervention_id)
|
||||||
return redirect("home")
|
if intervention.is_recorded:
|
||||||
if intervention.is_recorded:
|
messages.info(
|
||||||
messages.info(
|
request,
|
||||||
request,
|
RECORDED_BLOCKS_EDIT
|
||||||
RECORDED_BLOCKS_EDIT
|
|
||||||
)
|
|
||||||
return redirect("intervention:detail", id=intervention_id)
|
|
||||||
|
|
||||||
data_form = NewCompensationForm(request.POST or None, intervention_id=intervention_id)
|
|
||||||
geom_form = SimpleGeomForm(request.POST or None, read_only=False)
|
|
||||||
if request.method == "POST":
|
|
||||||
if data_form.is_valid() and geom_form.is_valid():
|
|
||||||
generated_identifier = data_form.cleaned_data.get("identifier", None)
|
|
||||||
comp = data_form.save(request.user, geom_form)
|
|
||||||
if generated_identifier != comp.identifier:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
IDENTIFIER_REPLACED.format(
|
|
||||||
generated_identifier,
|
|
||||||
comp.identifier
|
|
||||||
)
|
)
|
||||||
)
|
return redirect("intervention:detail", id=intervention_id)
|
||||||
messages.success(request, COMPENSATION_ADDED_TEMPLATE.format(comp.identifier))
|
except ObjectDoesNotExist:
|
||||||
if geom_form.geometry_simplified:
|
messages.error(request, PARAMS_INVALID, extra_tags="danger")
|
||||||
messages.info(
|
return redirect("home")
|
||||||
request,
|
return super().dispatch(request, *args, **kwargs)
|
||||||
GEOMETRY_SIMPLIFIED
|
|
||||||
)
|
|
||||||
return redirect("compensation:detail", id=comp.id)
|
|
||||||
else:
|
|
||||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
|
||||||
else:
|
|
||||||
# For clarification: nothing in this case
|
|
||||||
pass
|
|
||||||
context = {
|
|
||||||
"form": data_form,
|
|
||||||
"geom_form": geom_form,
|
|
||||||
TAB_TITLE_IDENTIFIER: _("New compensation"),
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class EditCompensationFormView(BaseEditSpatialLocatedObjectFormView):
|
||||||
@default_group_required
|
_MODEL_CLS = Compensation
|
||||||
def new_id_view(request: HttpRequest):
|
_FORM_CLS = EditCompensationForm
|
||||||
""" JSON endpoint
|
_TEMPLATE = "compensation/form/view.html"
|
||||||
|
_REDIRECT_URL = "compensation:detail"
|
||||||
|
|
||||||
Provides fetching of free identifiers for e.g. AJAX calls
|
def _user_has_permission(self, user):
|
||||||
|
# User has to be a default user
|
||||||
|
return user.is_default_user()
|
||||||
|
|
||||||
"""
|
|
||||||
tmp = Compensation()
|
class CompensationIdentifierGeneratorView(LoginRequiredMixin, BaseIdentifierGeneratorView):
|
||||||
identifier = tmp.generate_new_identifier()
|
_MODEL_CLS = Compensation
|
||||||
while Compensation.objects.filter(identifier=identifier).exists():
|
_REDIRECT_URL = "compensation:index"
|
||||||
identifier = tmp.generate_new_identifier()
|
|
||||||
return JsonResponse(
|
|
||||||
data={
|
class CompensationDetailView(BaseDetailView):
|
||||||
"gen_data": identifier
|
_MODEL_CLS = Compensation
|
||||||
|
_TEMPLATE = "compensation/detail/compensation/view.html"
|
||||||
|
|
||||||
|
def _get_object(self, id: str):
|
||||||
|
""" Returns the compensation
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (str): The compensation's id
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
obj (Compensation): The compensation
|
||||||
|
"""
|
||||||
|
comp = get_object_or_404(
|
||||||
|
Compensation.objects.select_related(
|
||||||
|
"modified",
|
||||||
|
"created",
|
||||||
|
"geometry"
|
||||||
|
),
|
||||||
|
id=id,
|
||||||
|
deleted=None,
|
||||||
|
intervention__deleted=None,
|
||||||
|
)
|
||||||
|
return comp
|
||||||
|
|
||||||
|
def _get_detail_context(self, obj: Compensation):
|
||||||
|
""" Generate object specific detail context for view
|
||||||
|
|
||||||
|
Args:
|
||||||
|
obj (): The record
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
# Order states according to surface
|
||||||
|
before_states = obj.before_states.all().prefetch_related("biotope_type").order_by("-surface")
|
||||||
|
after_states = obj.after_states.all().prefetch_related("biotope_type").order_by("-surface")
|
||||||
|
actions = obj.actions.all().prefetch_related("action_type")
|
||||||
|
|
||||||
|
# Precalculate logical errors between before- and after-states
|
||||||
|
# Sum() returns None in case of no states, so we catch that and replace it with 0 for easier handling
|
||||||
|
sum_before_states = obj.get_surface_before_states()
|
||||||
|
sum_after_states = obj.get_surface_after_states()
|
||||||
|
diff_states = abs(sum_before_states - sum_after_states)
|
||||||
|
|
||||||
|
last_checked = obj.intervention.get_last_checked_action()
|
||||||
|
last_checked_tooltip = ""
|
||||||
|
if last_checked:
|
||||||
|
last_checked_tooltip = DATA_CHECKED_PREVIOUSLY_TEMPLATE.format(
|
||||||
|
last_checked.get_timestamp_str_formatted(),
|
||||||
|
last_checked.user
|
||||||
|
)
|
||||||
|
|
||||||
|
context = {
|
||||||
|
"last_checked": last_checked,
|
||||||
|
"last_checked_tooltip": last_checked_tooltip,
|
||||||
|
"actions": actions,
|
||||||
|
"before_states": before_states,
|
||||||
|
"after_states": after_states,
|
||||||
|
"sum_before_states": sum_before_states,
|
||||||
|
"sum_after_states": sum_after_states,
|
||||||
|
"diff_states": diff_states,
|
||||||
|
"has_finished_deadlines": obj.get_finished_deadlines().exists(),
|
||||||
}
|
}
|
||||||
)
|
return context
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
@default_group_required
|
|
||||||
@shared_access_required(Compensation, "id")
|
|
||||||
def edit_view(request: HttpRequest, id: str):
|
|
||||||
"""
|
|
||||||
Renders a view for editing compensations
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request (HttpRequest): The incoming request
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
"""
|
|
||||||
template = "compensation/form/view.html"
|
|
||||||
# Get object from db
|
|
||||||
comp = get_object_or_404(Compensation, id=id)
|
|
||||||
if comp.is_recorded:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
RECORDED_BLOCKS_EDIT
|
|
||||||
)
|
|
||||||
return redirect("compensation:detail", id=id)
|
|
||||||
|
|
||||||
# Create forms, initialize with values from db/from POST request
|
|
||||||
data_form = EditCompensationForm(request.POST or None, instance=comp)
|
|
||||||
geom_form = SimpleGeomForm(request.POST or None, read_only=False, instance=comp)
|
|
||||||
if request.method == "POST":
|
|
||||||
if data_form.is_valid() and geom_form.is_valid():
|
|
||||||
# Preserve state of intervention checked to determine whether the user must be informed or not
|
|
||||||
# about a change of the check state
|
|
||||||
intervention_is_checked = comp.intervention.checked is not None
|
|
||||||
|
|
||||||
# The data form takes the geom form for processing, as well as the performing user
|
|
||||||
comp = data_form.save(request.user, geom_form)
|
|
||||||
if intervention_is_checked:
|
|
||||||
messages.info(request, CHECK_STATE_RESET)
|
|
||||||
messages.success(request, _("Compensation {} edited").format(comp.identifier))
|
|
||||||
if geom_form.geometry_simplified:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
GEOMETRY_SIMPLIFIED
|
|
||||||
)
|
|
||||||
return redirect("compensation:detail", id=comp.id)
|
|
||||||
else:
|
|
||||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
|
||||||
else:
|
|
||||||
# For clarification: nothing in this case
|
|
||||||
pass
|
|
||||||
context = {
|
|
||||||
"form": data_form,
|
|
||||||
"geom_form": geom_form,
|
|
||||||
TAB_TITLE_IDENTIFIER: _("Edit {}").format(comp.identifier),
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
@any_group_check
|
|
||||||
@uuid_required
|
|
||||||
def detail_view(request: HttpRequest, id: str):
|
|
||||||
""" Renders a detail view for a compensation
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request (HttpRequest): The incoming request
|
|
||||||
id (str): The compensation's id
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
"""
|
|
||||||
template = "compensation/detail/compensation/view.html"
|
|
||||||
comp = get_object_or_404(
|
|
||||||
Compensation.objects.select_related(
|
|
||||||
"modified",
|
|
||||||
"created",
|
|
||||||
"geometry"
|
|
||||||
),
|
|
||||||
id=id,
|
|
||||||
deleted=None,
|
|
||||||
intervention__deleted=None,
|
|
||||||
)
|
|
||||||
geom_form = SimpleGeomForm(instance=comp)
|
|
||||||
parcels = comp.get_underlying_parcels()
|
|
||||||
_user = request.user
|
|
||||||
is_data_shared = comp.intervention.is_shared_with(_user)
|
|
||||||
|
|
||||||
# Order states according to surface
|
|
||||||
before_states = comp.before_states.all().prefetch_related("biotope_type").order_by("-surface")
|
|
||||||
after_states = comp.after_states.all().prefetch_related("biotope_type").order_by("-surface")
|
|
||||||
actions = comp.actions.all().prefetch_related("action_type")
|
|
||||||
|
|
||||||
# Precalculate logical errors between before- and after-states
|
|
||||||
# Sum() returns None in case of no states, so we catch that and replace it with 0 for easier handling
|
|
||||||
sum_before_states = comp.get_surface_before_states()
|
|
||||||
sum_after_states = comp.get_surface_after_states()
|
|
||||||
diff_states = abs(sum_before_states - sum_after_states)
|
|
||||||
|
|
||||||
request = comp.set_status_messages(request)
|
|
||||||
|
|
||||||
last_checked = comp.intervention.get_last_checked_action()
|
|
||||||
last_checked_tooltip = ""
|
|
||||||
if last_checked:
|
|
||||||
last_checked_tooltip = DATA_CHECKED_PREVIOUSLY_TEMPLATE.format(last_checked.get_timestamp_str_formatted(), last_checked.user)
|
|
||||||
|
|
||||||
requesting_user_is_only_shared_user = comp.is_only_shared_with(_user)
|
|
||||||
if requesting_user_is_only_shared_user:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
DO_NOT_FORGET_TO_SHARE
|
|
||||||
)
|
|
||||||
|
|
||||||
context = {
|
|
||||||
"obj": comp,
|
|
||||||
"last_checked": last_checked,
|
|
||||||
"last_checked_tooltip": last_checked_tooltip,
|
|
||||||
"geom_form": geom_form,
|
|
||||||
"parcels": parcels,
|
|
||||||
"has_access": is_data_shared,
|
|
||||||
"actions": actions,
|
|
||||||
"before_states": before_states,
|
|
||||||
"after_states": after_states,
|
|
||||||
"sum_before_states": sum_before_states,
|
|
||||||
"sum_after_states": sum_after_states,
|
|
||||||
"diff_states": diff_states,
|
|
||||||
"is_default_member": _user.in_group(DEFAULT_GROUP),
|
|
||||||
"is_zb_member": _user.in_group(ZB_GROUP),
|
|
||||||
"is_ets_member": _user.in_group(ETS_GROUP),
|
|
||||||
"LANIS_LINK": comp.get_LANIS_link(),
|
|
||||||
TAB_TITLE_IDENTIFIER: f"{comp.identifier} - {comp.title}",
|
|
||||||
"has_finished_deadlines": comp.get_finished_deadlines().exists(),
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required_modal
|
@login_required_modal
|
||||||
|
|||||||
@@ -5,76 +5,48 @@ Contact: ksp-servicestelle@sgdnord.rlp.de
|
|||||||
Created on: 19.08.22
|
Created on: 19.08.22
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.http import HttpRequest
|
|
||||||
from django.shortcuts import get_object_or_404, render
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
|
|
||||||
from compensation.models import Compensation
|
from compensation.models import Compensation
|
||||||
from konova.contexts import BaseContext
|
from konova.sub_settings.django_settings import BASE_URL
|
||||||
from konova.forms import SimpleGeomForm
|
from konova.utils.qrcode import QrCode
|
||||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
from konova.views.report import BaseReportView
|
||||||
from konova.utils.generators import generate_qr_code
|
|
||||||
|
|
||||||
|
|
||||||
def report_view(request: HttpRequest, id: str):
|
class BaseCompensationReportView(BaseReportView):
|
||||||
""" Renders the public report view
|
def _get_compensation_report_context(self, obj):
|
||||||
|
# Order states by surface
|
||||||
|
before_states = obj.before_states.all().order_by("-surface").prefetch_related("biotope_type")
|
||||||
|
after_states = obj.after_states.all().order_by("-surface").prefetch_related("biotope_type")
|
||||||
|
actions = obj.actions.all().prefetch_related("action_type")
|
||||||
|
|
||||||
Args:
|
return {
|
||||||
request (HttpRequest): The incoming request
|
"before_states": before_states,
|
||||||
id (str): The id of the intervention
|
"after_states": after_states,
|
||||||
|
"actions": actions,
|
||||||
Returns:
|
|
||||||
|
|
||||||
"""
|
|
||||||
# Reuse the compensation report template since compensations are structurally identical
|
|
||||||
template = "compensation/report/compensation/report.html"
|
|
||||||
comp = get_object_or_404(Compensation, id=id)
|
|
||||||
|
|
||||||
tab_title = _("Report {}").format(comp.identifier)
|
|
||||||
# If intervention is not recorded (yet or currently) we need to render another template without any data
|
|
||||||
if not comp.is_ready_for_publish():
|
|
||||||
template = "report/unavailable.html"
|
|
||||||
context = {
|
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
|
||||||
}
|
}
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
# Prepare data for map viewer
|
|
||||||
geom_form = SimpleGeomForm(
|
|
||||||
instance=comp
|
|
||||||
)
|
|
||||||
parcels = comp.get_underlying_parcels()
|
|
||||||
|
|
||||||
qrcode_url = request.build_absolute_uri(reverse("compensation:report", args=(id,)))
|
class CompensationReportView(BaseCompensationReportView):
|
||||||
qrcode_img = generate_qr_code(qrcode_url, 10)
|
_MODEL = Compensation
|
||||||
qrcode_lanis_url = comp.get_LANIS_link()
|
_TEMPLATE = "compensation/report/compensation/report.html"
|
||||||
qrcode_img_lanis = generate_qr_code(qrcode_lanis_url, 7)
|
|
||||||
|
|
||||||
# Order states by surface
|
def _get_report_context(self, obj):
|
||||||
before_states = comp.before_states.all().order_by("-surface").prefetch_related("biotope_type")
|
report_url = BASE_URL + reverse("compensation:report", args=(obj.id,))
|
||||||
after_states = comp.after_states.all().order_by("-surface").prefetch_related("biotope_type")
|
qrcode_report = QrCode(report_url, 10)
|
||||||
actions = comp.actions.all().prefetch_related("action_type")
|
qrcode_lanis = QrCode(obj.get_LANIS_link(), 7)
|
||||||
|
|
||||||
context = {
|
report_context = {
|
||||||
"obj": comp,
|
"qrcode": {
|
||||||
"qrcode": {
|
"img": qrcode_report.get_img(),
|
||||||
"img": qrcode_img,
|
"url": qrcode_report.get_content(),
|
||||||
"url": qrcode_url,
|
},
|
||||||
},
|
"qrcode_lanis": {
|
||||||
"qrcode_lanis": {
|
"img": qrcode_lanis.get_img(),
|
||||||
"img": qrcode_img_lanis,
|
"url": qrcode_lanis.get_content(),
|
||||||
"url": qrcode_lanis_url,
|
},
|
||||||
},
|
"is_entry_shared": False, # disables action buttons during rendering
|
||||||
"has_access": False, # disables action buttons during rendering
|
"tables_scrollable": False,
|
||||||
"before_states": before_states,
|
}
|
||||||
"after_states": after_states,
|
report_context.update(self._get_compensation_report_context(obj))
|
||||||
"geom_form": geom_form,
|
return report_context
|
||||||
"parcels": parcels,
|
|
||||||
"actions": actions,
|
|
||||||
"tables_scrollable": False,
|
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
@@ -5,54 +5,28 @@ Contact: ksp-servicestelle@sgdnord.rlp.de
|
|||||||
Created on: 19.08.22
|
Created on: 19.08.22
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.utils.decorators import method_decorator
|
|
||||||
|
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from konova.decorators import default_group_required, login_required_modal
|
|
||||||
from konova.views.deduction import AbstractNewDeductionView, AbstractEditDeductionView, AbstractRemoveDeductionView
|
from konova.views.deduction import AbstractNewDeductionView, AbstractEditDeductionView, AbstractRemoveDeductionView
|
||||||
|
|
||||||
|
|
||||||
class NewEcoAccountDeductionView(AbstractNewDeductionView):
|
class NewEcoAccountDeductionView(LoginRequiredMixin, AbstractNewDeductionView):
|
||||||
model = EcoAccount
|
_MODEL = EcoAccount
|
||||||
redirect_url = "compensation:acc:detail"
|
_REDIRECT_URL = "compensation:acc:detail"
|
||||||
|
|
||||||
@method_decorator(login_required_modal)
|
|
||||||
@method_decorator(login_required)
|
|
||||||
@method_decorator(default_group_required)
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
|
||||||
return super().dispatch(request, *args, **kwargs)
|
|
||||||
|
|
||||||
def _custom_check(self, obj):
|
def _custom_check(self, obj):
|
||||||
|
# New deductions can only be created if the eco account has been recorded
|
||||||
if not obj.recorded:
|
if not obj.recorded:
|
||||||
raise Http404()
|
raise Http404()
|
||||||
|
|
||||||
|
|
||||||
class EditEcoAccountDeductionView(AbstractEditDeductionView):
|
class EditEcoAccountDeductionView(LoginRequiredMixin, AbstractEditDeductionView):
|
||||||
def _custom_check(self, obj):
|
_MODEL = EcoAccount
|
||||||
pass
|
_REDIRECT_URL = "compensation:acc:detail"
|
||||||
|
|
||||||
model = EcoAccount
|
|
||||||
redirect_url = "compensation:acc:detail"
|
|
||||||
|
|
||||||
@method_decorator(login_required_modal)
|
|
||||||
@method_decorator(login_required)
|
|
||||||
@method_decorator(default_group_required)
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
|
||||||
return super().dispatch(request, *args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class RemoveEcoAccountDeductionView(AbstractRemoveDeductionView):
|
class RemoveEcoAccountDeductionView(LoginRequiredMixin, AbstractRemoveDeductionView):
|
||||||
def _custom_check(self, obj):
|
_MODEL = EcoAccount
|
||||||
pass
|
_REDIRECT_URL = "compensation:acc:detail"
|
||||||
|
|
||||||
model = EcoAccount
|
|
||||||
redirect_url = "compensation:acc:detail"
|
|
||||||
|
|
||||||
@method_decorator(login_required_modal)
|
|
||||||
@method_decorator(login_required)
|
|
||||||
@method_decorator(default_group_required)
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
|
||||||
return super().dispatch(request, *args, **kwargs)
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ Created on: 19.08.22
|
|||||||
"""
|
"""
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.db.models import Sum
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.http import HttpRequest, JsonResponse
|
from django.http import HttpRequest
|
||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@@ -17,43 +17,51 @@ from compensation.forms.eco_account import EditEcoAccountForm, NewEcoAccountForm
|
|||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from compensation.tables.eco_account import EcoAccountTable
|
from compensation.tables.eco_account import EcoAccountTable
|
||||||
from konova.contexts import BaseContext
|
from konova.contexts import BaseContext
|
||||||
from konova.decorators import shared_access_required, default_group_required, any_group_check, login_required_modal, \
|
from konova.decorators import shared_access_required, default_group_required, login_required_modal
|
||||||
uuid_required
|
|
||||||
from konova.forms import SimpleGeomForm
|
from konova.forms import SimpleGeomForm
|
||||||
from konova.settings import ETS_GROUP, DEFAULT_GROUP, ZB_GROUP
|
from konova.settings import ETS_GROUP
|
||||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||||
from konova.utils.message_templates import CANCEL_ACC_RECORDED_OR_DEDUCTED, RECORDED_BLOCKS_EDIT, FORM_INVALID, \
|
from konova.utils.message_templates import CANCEL_ACC_RECORDED_OR_DEDUCTED, RECORDED_BLOCKS_EDIT, FORM_INVALID, \
|
||||||
IDENTIFIER_REPLACED, DO_NOT_FORGET_TO_SHARE, GEOMETRY_SIMPLIFIED
|
IDENTIFIER_REPLACED, GEOMETRY_SIMPLIFIED, GEOMETRIES_IGNORED_TEMPLATE
|
||||||
|
from konova.views.base import BaseIndexView, BaseIdentifierGeneratorView, BaseNewSpatialLocatedObjectFormView, \
|
||||||
|
BaseEditSpatialLocatedObjectFormView
|
||||||
|
from konova.views.detail import BaseDetailView
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class EcoAccountIndexView(LoginRequiredMixin, BaseIndexView):
|
||||||
@any_group_check
|
_INDEX_TABLE_CLS = EcoAccountTable
|
||||||
def index_view(request: HttpRequest):
|
_TAB_TITLE = _("Eco-account - Overview")
|
||||||
"""
|
|
||||||
Renders the index view for eco accounts
|
|
||||||
|
|
||||||
Args:
|
def _get_queryset(self):
|
||||||
request (HttpRequest): The incoming request
|
qs = EcoAccount.objects.filter(
|
||||||
|
deleted=None,
|
||||||
|
).order_by(
|
||||||
|
"-modified__timestamp"
|
||||||
|
)
|
||||||
|
return qs
|
||||||
|
|
||||||
Returns:
|
|
||||||
A rendered view
|
class NewEcoAccountFormView(BaseNewSpatialLocatedObjectFormView):
|
||||||
"""
|
_FORM_CLS = NewEcoAccountForm
|
||||||
template = "generic_index.html"
|
_MODEL_CLS = EcoAccount
|
||||||
eco_accounts = EcoAccount.objects.filter(
|
_TEMPLATE = "compensation/form/view.html"
|
||||||
deleted=None,
|
_TAB_TITLE = _("New Eco-Account")
|
||||||
).order_by(
|
_REDIRECT_URL = "compensation:acc:detail"
|
||||||
"-modified__timestamp"
|
|
||||||
)
|
def _user_has_permission(self, user):
|
||||||
table = EcoAccountTable(
|
# User has to be a default user
|
||||||
request=request,
|
return user.is_default_user()
|
||||||
queryset=eco_accounts
|
|
||||||
)
|
|
||||||
context = {
|
class EditEcoAccountFormView(BaseEditSpatialLocatedObjectFormView):
|
||||||
"table": table,
|
_FORM_CLS = EditEcoAccountForm
|
||||||
TAB_TITLE_IDENTIFIER: _("Eco-account - Overview"),
|
_MODEL_CLS = EcoAccount
|
||||||
}
|
_TEMPLATE = "compensation/form/view.html"
|
||||||
context = BaseContext(request, context).context
|
_REDIRECT_URL = "compensation:acc:detail"
|
||||||
return render(request, template, context)
|
|
||||||
|
def _user_has_permission(self, user):
|
||||||
|
# User has to be a default user
|
||||||
|
return user.is_default_user()
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@@ -84,11 +92,19 @@ def new_view(request: HttpRequest):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
messages.success(request, _("Eco-Account {} added").format(acc.identifier))
|
messages.success(request, _("Eco-Account {} added").format(acc.identifier))
|
||||||
if geom_form.geometry_simplified:
|
if geom_form.has_geometry_simplified():
|
||||||
messages.info(
|
messages.info(
|
||||||
request,
|
request,
|
||||||
GEOMETRY_SIMPLIFIED
|
GEOMETRY_SIMPLIFIED
|
||||||
)
|
)
|
||||||
|
|
||||||
|
num_ignored_geometries = geom_form.get_num_geometries_ignored()
|
||||||
|
if num_ignored_geometries > 0:
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
GEOMETRIES_IGNORED_TEMPLATE.format(num_ignored_geometries)
|
||||||
|
)
|
||||||
|
|
||||||
return redirect("compensation:acc:detail", id=acc.id)
|
return redirect("compensation:acc:detail", id=acc.id)
|
||||||
else:
|
else:
|
||||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
||||||
@@ -104,23 +120,9 @@ def new_view(request: HttpRequest):
|
|||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class EcoAccountIdentifierGeneratorView(LoginRequiredMixin, BaseIdentifierGeneratorView):
|
||||||
@default_group_required
|
_MODEL_CLS = EcoAccount
|
||||||
def new_id_view(request: HttpRequest):
|
_REDIRECT_URL = "compensation:acc:index"
|
||||||
""" JSON endpoint
|
|
||||||
|
|
||||||
Provides fetching of free identifiers for e.g. AJAX calls
|
|
||||||
|
|
||||||
"""
|
|
||||||
tmp = EcoAccount()
|
|
||||||
identifier = tmp.generate_new_identifier()
|
|
||||||
while EcoAccount.objects.filter(identifier=identifier).exists():
|
|
||||||
identifier = tmp.generate_new_identifier()
|
|
||||||
return JsonResponse(
|
|
||||||
data={
|
|
||||||
"gen_data": identifier
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@@ -156,11 +158,19 @@ def edit_view(request: HttpRequest, id: str):
|
|||||||
# The data form takes the geom form for processing, as well as the performing user
|
# The data form takes the geom form for processing, as well as the performing user
|
||||||
acc = data_form.save(request.user, geom_form)
|
acc = data_form.save(request.user, geom_form)
|
||||||
messages.success(request, _("Eco-Account {} edited").format(acc.identifier))
|
messages.success(request, _("Eco-Account {} edited").format(acc.identifier))
|
||||||
if geom_form.geometry_simplified:
|
if geom_form.has_geometry_simplified():
|
||||||
messages.info(
|
messages.info(
|
||||||
request,
|
request,
|
||||||
GEOMETRY_SIMPLIFIED
|
GEOMETRY_SIMPLIFIED
|
||||||
)
|
)
|
||||||
|
|
||||||
|
num_ignored_geometries = geom_form.get_num_geometries_ignored()
|
||||||
|
if num_ignored_geometries > 0:
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
GEOMETRIES_IGNORED_TEMPLATE.format(num_ignored_geometries)
|
||||||
|
)
|
||||||
|
|
||||||
return redirect("compensation:acc:detail", id=acc.id)
|
return redirect("compensation:acc:detail", id=acc.id)
|
||||||
else:
|
else:
|
||||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
||||||
@@ -176,86 +186,72 @@ def edit_view(request: HttpRequest, id: str):
|
|||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class EcoAccountDetailView(BaseDetailView):
|
||||||
@any_group_check
|
_MODEL_CLS = EcoAccount
|
||||||
@uuid_required
|
_TEMPLATE = "compensation/detail/eco_account/view.html"
|
||||||
def detail_view(request: HttpRequest, id: str):
|
|
||||||
""" Renders a detail view for a compensation
|
|
||||||
|
|
||||||
Args:
|
def _get_object(self, id: str):
|
||||||
request (HttpRequest): The incoming request
|
""" Fetch object for detail view
|
||||||
id (str): The compensation's id
|
|
||||||
|
|
||||||
Returns:
|
Args:
|
||||||
|
id (str): The record's id'
|
||||||
|
|
||||||
"""
|
Returns:
|
||||||
template = "compensation/detail/eco_account/view.html"
|
|
||||||
acc = get_object_or_404(
|
|
||||||
EcoAccount.objects.prefetch_related(
|
|
||||||
"deadlines",
|
|
||||||
).select_related(
|
|
||||||
'geometry',
|
|
||||||
'responsible',
|
|
||||||
),
|
|
||||||
id=id,
|
|
||||||
deleted=None,
|
|
||||||
)
|
|
||||||
geom_form = SimpleGeomForm(instance=acc)
|
|
||||||
parcels = acc.get_underlying_parcels()
|
|
||||||
_user = request.user
|
|
||||||
is_data_shared = acc.is_shared_with(_user)
|
|
||||||
|
|
||||||
# Order states according to surface
|
"""
|
||||||
before_states = acc.before_states.order_by("-surface")
|
acc = get_object_or_404(
|
||||||
after_states = acc.after_states.order_by("-surface")
|
EcoAccount.objects.prefetch_related(
|
||||||
|
"deadlines",
|
||||||
# Precalculate logical errors between before- and after-states
|
).select_related(
|
||||||
# Sum() returns None in case of no states, so we catch that and replace it with 0 for easier handling
|
'geometry',
|
||||||
sum_before_states = acc.get_surface_before_states()
|
'responsible',
|
||||||
sum_after_states = acc.get_surface_after_states()
|
),
|
||||||
diff_states = abs(sum_before_states - sum_after_states)
|
id=id,
|
||||||
# Calculate rest of available surface for deductions
|
deleted=None,
|
||||||
available_total = acc.deductable_rest
|
|
||||||
available_relative = acc.get_deductable_rest_relative()
|
|
||||||
|
|
||||||
# Prefetch related data to decrease the amount of db connections
|
|
||||||
deductions = acc.deductions.filter(
|
|
||||||
intervention__deleted=None,
|
|
||||||
)
|
|
||||||
actions = acc.actions.all()
|
|
||||||
|
|
||||||
request = acc.set_status_messages(request)
|
|
||||||
|
|
||||||
requesting_user_is_only_shared_user = acc.is_only_shared_with(_user)
|
|
||||||
if requesting_user_is_only_shared_user:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
DO_NOT_FORGET_TO_SHARE
|
|
||||||
)
|
)
|
||||||
|
return acc
|
||||||
|
|
||||||
context = {
|
def _get_detail_context(self, obj: EcoAccount):
|
||||||
"obj": acc,
|
""" Generate object specific detail context for view
|
||||||
"geom_form": geom_form,
|
|
||||||
"parcels": parcels,
|
Args:
|
||||||
"has_access": is_data_shared,
|
obj (): The record
|
||||||
"before_states": before_states,
|
|
||||||
"after_states": after_states,
|
Returns:
|
||||||
"sum_before_states": sum_before_states,
|
|
||||||
"sum_after_states": sum_after_states,
|
"""
|
||||||
"diff_states": diff_states,
|
# Order states according to surface
|
||||||
"available": available_relative,
|
before_states = obj.before_states.order_by("-surface")
|
||||||
"available_total": available_total,
|
after_states = obj.after_states.order_by("-surface")
|
||||||
"is_default_member": _user.in_group(DEFAULT_GROUP),
|
|
||||||
"is_zb_member": _user.in_group(ZB_GROUP),
|
# Precalculate logical errors between before- and after-states
|
||||||
"is_ets_member": _user.in_group(ETS_GROUP),
|
# Sum() returns None in case of no states, so we catch that and replace it with 0 for easier handling
|
||||||
"LANIS_LINK": acc.get_LANIS_link(),
|
sum_before_states = obj.get_surface_before_states()
|
||||||
"deductions": deductions,
|
sum_after_states = obj.get_surface_after_states()
|
||||||
"actions": actions,
|
diff_states = abs(sum_before_states - sum_after_states)
|
||||||
TAB_TITLE_IDENTIFIER: f"{acc.identifier} - {acc.title}",
|
# Calculate rest of available surface for deductions
|
||||||
"has_finished_deadlines": acc.get_finished_deadlines().exists(),
|
available_total = obj.deductable_rest
|
||||||
}
|
available_relative = obj.get_deductable_rest_relative()
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
# Prefetch related data to decrease the amount of db connections
|
||||||
|
deductions = obj.deductions.filter(
|
||||||
|
intervention__deleted=None,
|
||||||
|
)
|
||||||
|
actions = obj.actions.all()
|
||||||
|
|
||||||
|
context = {
|
||||||
|
"before_states": before_states,
|
||||||
|
"after_states": after_states,
|
||||||
|
"sum_before_states": sum_before_states,
|
||||||
|
"sum_after_states": sum_after_states,
|
||||||
|
"diff_states": diff_states,
|
||||||
|
"available": available_relative,
|
||||||
|
"available_total": available_total,
|
||||||
|
"deductions": deductions,
|
||||||
|
"actions": actions,
|
||||||
|
"has_finished_deadlines": obj.get_finished_deadlines().exists(),
|
||||||
|
}
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
@login_required_modal
|
@login_required_modal
|
||||||
|
|||||||
@@ -5,83 +5,41 @@ Contact: ksp-servicestelle@sgdnord.rlp.de
|
|||||||
Created on: 19.08.22
|
Created on: 19.08.22
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.http import HttpRequest
|
|
||||||
from django.shortcuts import get_object_or_404, render
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
|
|
||||||
from compensation.models import EcoAccount
|
from compensation.models import EcoAccount
|
||||||
from konova.contexts import BaseContext
|
from compensation.views.compensation.report import BaseCompensationReportView
|
||||||
from konova.forms import SimpleGeomForm
|
from konova.sub_settings.django_settings import BASE_URL
|
||||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
from konova.utils.qrcode import QrCode
|
||||||
from konova.utils.generators import generate_qr_code
|
|
||||||
|
|
||||||
|
|
||||||
def report_view(request: HttpRequest, id: str):
|
class EcoAccountReportView(BaseCompensationReportView):
|
||||||
""" Renders the public report view
|
_MODEL = EcoAccount
|
||||||
|
_TEMPLATE = "compensation/report/eco_account/report.html"
|
||||||
|
|
||||||
Args:
|
def _get_report_context(self, obj):
|
||||||
request (HttpRequest): The incoming request
|
report_url = BASE_URL + reverse("compensation:acc:report", args=(obj.id,))
|
||||||
id (str): The id of the intervention
|
qrcode_report = QrCode(report_url, 10)
|
||||||
|
qrcode_lanis = QrCode(obj.get_LANIS_link(), 7)
|
||||||
|
|
||||||
Returns:
|
# Reduce amount of db fetched data to the bare minimum we need in the template (deduction's intervention id and identifier)
|
||||||
|
deductions = obj.deductions.all() \
|
||||||
|
.distinct("intervention") \
|
||||||
|
.select_related("intervention") \
|
||||||
|
.values_list("intervention__id", "intervention__identifier", "intervention__title", named=True)
|
||||||
|
|
||||||
"""
|
report_context = {
|
||||||
# Reuse the compensation report template since EcoAccounts are structurally identical
|
"qrcode": {
|
||||||
template = "compensation/report/eco_account/report.html"
|
"img": qrcode_report.get_img(),
|
||||||
acc = get_object_or_404(EcoAccount, id=id)
|
"url": qrcode_report.get_content(),
|
||||||
|
},
|
||||||
tab_title = _("Report {}").format(acc.identifier)
|
"qrcode_lanis": {
|
||||||
# If intervention is not recorded (yet or currently) we need to render another template without any data
|
"img": qrcode_lanis.get_img(),
|
||||||
if not acc.is_ready_for_publish():
|
"url": qrcode_lanis.get_content(),
|
||||||
template = "report/unavailable.html"
|
},
|
||||||
context = {
|
"is_entry_shared": False, # disables action buttons during rendering
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
"deductions": deductions,
|
||||||
|
"tables_scrollable": False,
|
||||||
}
|
}
|
||||||
context = BaseContext(request, context).context
|
report_context.update(self._get_compensation_report_context(obj))
|
||||||
return render(request, template, context)
|
return report_context
|
||||||
|
|
||||||
# Prepare data for map viewer
|
|
||||||
geom_form = SimpleGeomForm(
|
|
||||||
instance=acc
|
|
||||||
)
|
|
||||||
parcels = acc.get_underlying_parcels()
|
|
||||||
|
|
||||||
qrcode_url = request.build_absolute_uri(reverse("compensation:acc:report", args=(id,)))
|
|
||||||
qrcode_img = generate_qr_code(qrcode_url, 10)
|
|
||||||
qrcode_lanis_url = acc.get_LANIS_link()
|
|
||||||
qrcode_img_lanis = generate_qr_code(qrcode_lanis_url, 7)
|
|
||||||
|
|
||||||
# Order states by surface
|
|
||||||
before_states = acc.before_states.all().order_by("-surface").select_related("biotope_type__parent")
|
|
||||||
after_states = acc.after_states.all().order_by("-surface").select_related("biotope_type__parent")
|
|
||||||
actions = acc.actions.all().prefetch_related("action_type__parent")
|
|
||||||
|
|
||||||
# Reduce amount of db fetched data to the bare minimum we need in the template (deduction's intervention id and identifier)
|
|
||||||
deductions = acc.deductions.all()\
|
|
||||||
.distinct("intervention")\
|
|
||||||
.select_related("intervention")\
|
|
||||||
.values_list("intervention__id", "intervention__identifier", "intervention__title", named=True)
|
|
||||||
|
|
||||||
context = {
|
|
||||||
"obj": acc,
|
|
||||||
"qrcode": {
|
|
||||||
"img": qrcode_img,
|
|
||||||
"url": qrcode_url,
|
|
||||||
},
|
|
||||||
"qrcode_lanis": {
|
|
||||||
"img": qrcode_img_lanis,
|
|
||||||
"url": qrcode_lanis_url,
|
|
||||||
},
|
|
||||||
"has_access": False, # disables action buttons during rendering
|
|
||||||
"before_states": before_states,
|
|
||||||
"after_states": after_states,
|
|
||||||
"geom_form": geom_form,
|
|
||||||
"parcels": parcels,
|
|
||||||
"actions": actions,
|
|
||||||
"deductions": deductions,
|
|
||||||
"tables_scrollable": False,
|
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'ema:new-action' obj.id %}" title="{% trans 'Add new action' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'ema:new-action' obj.id %}" title="{% trans 'Add new action' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'seedling' %}
|
{% fa5_icon 'seedling' %}
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'ema:action-edit' obj.id action.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit action' %}">
|
<button data-form-url="{% url 'ema:action-edit' obj.id action.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit action' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
{% fa5_icon 'file-alt' %}
|
{% fa5_icon 'file-alt' %}
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
{% if has_access %}
|
{% if is_entry_shared %}
|
||||||
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Resubmission' %}" data-form-url="{% url 'ema:resubmission-create' obj.id %}">
|
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Resubmission' %}" data-form-url="{% url 'ema:resubmission-create' obj.id %}">
|
||||||
{% fa5_icon 'bell' %}
|
{% fa5_icon 'bell' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'ema:new-deadline' obj.id %}" title="{% trans 'Add new deadline' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'ema:new-deadline' obj.id %}" title="{% trans 'Add new deadline' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'calendar-check' %}
|
{% fa5_icon 'calendar-check' %}
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'ema:deadline-edit' obj.id deadline.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit deadline' %}">
|
<button data-form-url="{% url 'ema:deadline-edit' obj.id deadline.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit deadline' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'ema:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'ema:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'file' %}
|
{% fa5_icon 'file' %}
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'ema:edit-doc' obj.id doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit document' %}">
|
<button data-form-url="{% url 'ema:edit-doc' obj.id doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit document' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'ema:new-state' obj.id %}" title="{% trans 'Add new state after' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'ema:new-state' obj.id %}" title="{% trans 'Add new state after' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'layer-group' %}
|
{% fa5_icon 'layer-group' %}
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ state.surface|floatformat:2 }} m²</td>
|
<td>{{ state.surface|floatformat:2 }} m²</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'ema:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
<button data-form-url="{% url 'ema:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'ema:new-state' obj.id %}?before=true" title="{% trans 'Add new state before' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'ema:new-state' obj.id %}?before=true" title="{% trans 'Add new state before' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'layer-group' %}
|
{% fa5_icon 'layer-group' %}
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ state.surface|floatformat:2 }} m²</td>
|
<td>{{ state.surface|floatformat:2 }} m²</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'ema:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
<button data-form-url="{% url 'ema:state-edit' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit state' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
{% include 'user/includes/team_data_modal_button.html' %}
|
{% include 'user/includes/team_data_modal_button.html' %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<hr>
|
<hr>
|
||||||
{% if has_access %}
|
{% if is_entry_shared %}
|
||||||
{% for user in obj.users.all %}
|
{% for user in obj.users.all %}
|
||||||
{% include 'user/includes/contact_modal_button.html' %}
|
{% include 'user/includes/contact_modal_button.html' %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class EmaWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
post_data = {
|
post_data = {
|
||||||
"identifier": test_id,
|
"identifier": test_id,
|
||||||
"title": test_title,
|
"title": test_title,
|
||||||
"geom": geom_json,
|
"output": geom_json,
|
||||||
"conservation_office": test_conservation_office.id
|
"conservation_office": test_conservation_office.id
|
||||||
}
|
}
|
||||||
self.client_user.post(new_url, post_data)
|
self.client_user.post(new_url, post_data)
|
||||||
@@ -84,7 +84,7 @@ class EmaWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
new_title = self.create_dummy_string()
|
new_title = self.create_dummy_string()
|
||||||
new_identifier = self.create_dummy_string()
|
new_identifier = self.create_dummy_string()
|
||||||
new_comment = self.create_dummy_string()
|
new_comment = self.create_dummy_string()
|
||||||
new_geometry = MultiPolygon(srid=4326) # Create an empty geometry
|
new_geometry = self.create_dummy_geometry() # Create an empty geometry
|
||||||
test_conservation_office = self.get_conservation_office_code()
|
test_conservation_office = self.get_conservation_office_code()
|
||||||
|
|
||||||
check_on_elements = {
|
check_on_elements = {
|
||||||
@@ -99,7 +99,7 @@ class EmaWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
"identifier": new_identifier,
|
"identifier": new_identifier,
|
||||||
"title": new_title,
|
"title": new_title,
|
||||||
"comment": new_comment,
|
"comment": new_comment,
|
||||||
"geom": new_geometry.geojson,
|
"output": self.create_geojson(new_geometry),
|
||||||
"conservation_office": test_conservation_office.id
|
"conservation_office": test_conservation_office.id
|
||||||
}
|
}
|
||||||
self.client_user.post(url, post_data)
|
self.client_user.post(url, post_data)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class NewEmaFormTestCase(BaseTestCase):
|
|||||||
)
|
)
|
||||||
geom_form_data = json.loads(geom_form_data)
|
geom_form_data = json.loads(geom_form_data)
|
||||||
geom_form_data = {
|
geom_form_data = {
|
||||||
"geom": json.dumps(geom_form_data)
|
"output": json.dumps(geom_form_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
geom_form = SimpleGeomForm(geom_form_data)
|
geom_form = SimpleGeomForm(geom_form_data)
|
||||||
@@ -116,7 +116,7 @@ class EditEmaFormTestCase(BaseTestCase):
|
|||||||
)
|
)
|
||||||
geom_form_data = json.loads(geom_form_data)
|
geom_form_data = json.loads(geom_form_data)
|
||||||
geom_form_data = {
|
geom_form_data = {
|
||||||
"geom": json.dumps(geom_form_data)
|
"output": json.dumps(geom_form_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
geom_form = SimpleGeomForm(geom_form_data)
|
geom_form = SimpleGeomForm(geom_form_data)
|
||||||
|
|||||||
17
ema/urls.py
17
ema/urls.py
@@ -10,25 +10,26 @@ from django.urls import path
|
|||||||
from ema.views.action import NewEmaActionView, EditEmaActionView, RemoveEmaActionView
|
from ema.views.action import NewEmaActionView, EditEmaActionView, RemoveEmaActionView
|
||||||
from ema.views.deadline import NewEmaDeadlineView, EditEmaDeadlineView, RemoveEmaDeadlineView
|
from ema.views.deadline import NewEmaDeadlineView, EditEmaDeadlineView, RemoveEmaDeadlineView
|
||||||
from ema.views.document import NewEmaDocumentView, EditEmaDocumentView, RemoveEmaDocumentView, GetEmaDocumentView
|
from ema.views.document import NewEmaDocumentView, EditEmaDocumentView, RemoveEmaDocumentView, GetEmaDocumentView
|
||||||
from ema.views.ema import index_view, new_view, new_id_view, detail_view, edit_view, remove_view
|
from ema.views.ema import remove_view, EmaIndexView, \
|
||||||
|
EmaIdentifierGeneratorView, EmaDetailView, EditEmaFormView, NewEmaFormView
|
||||||
from ema.views.log import EmaLogView
|
from ema.views.log import EmaLogView
|
||||||
from ema.views.record import EmaRecordView
|
from ema.views.record import EmaRecordView
|
||||||
from ema.views.report import report_view
|
from ema.views.report import EmaReportView
|
||||||
from ema.views.resubmission import EmaResubmissionView
|
from ema.views.resubmission import EmaResubmissionView
|
||||||
from ema.views.share import EmaShareFormView, EmaShareByTokenView
|
from ema.views.share import EmaShareFormView, EmaShareByTokenView
|
||||||
from ema.views.state import NewEmaStateView, EditEmaStateView, RemoveEmaStateView
|
from ema.views.state import NewEmaStateView, EditEmaStateView, RemoveEmaStateView
|
||||||
|
|
||||||
app_name = "ema"
|
app_name = "ema"
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", index_view, name="index"),
|
path("", EmaIndexView.as_view(), name="index"),
|
||||||
path("new/", new_view, name="new"),
|
path("new/", NewEmaFormView.as_view(), name="new"),
|
||||||
path("new/id", new_id_view, name="new-id"),
|
path("new/id", EmaIdentifierGeneratorView.as_view(), name="new-id"),
|
||||||
path("<id>", detail_view, name="detail"),
|
path("<id>", EmaDetailView.as_view(), name="detail"),
|
||||||
path('<id>/log', EmaLogView.as_view(), name='log'),
|
path('<id>/log', EmaLogView.as_view(), name='log'),
|
||||||
path('<id>/edit', edit_view, name='edit'),
|
path('<id>/edit', EditEmaFormView.as_view(), name='edit'),
|
||||||
path('<id>/remove', remove_view, name='remove'),
|
path('<id>/remove', remove_view, name='remove'),
|
||||||
path('<id>/record', EmaRecordView.as_view(), name='record'),
|
path('<id>/record', EmaRecordView.as_view(), name='record'),
|
||||||
path('<id>/report', report_view, name='report'),
|
path('<id>/report', EmaReportView.as_view(), name='report'),
|
||||||
path('<id>/resub', EmaResubmissionView.as_view(), name='resubmission-create'),
|
path('<id>/resub', EmaResubmissionView.as_view(), name='resubmission-create'),
|
||||||
|
|
||||||
path('<id>/state/new', NewEmaStateView.as_view(), name='new-state'),
|
path('<id>/state/new', NewEmaStateView.as_view(), name='new-state'),
|
||||||
|
|||||||
296
ema/views/ema.py
296
ema/views/ema.py
@@ -5,234 +5,112 @@ Contact: ksp-servicestelle@sgdnord.rlp.de
|
|||||||
Created on: 19.08.22
|
Created on: 19.08.22
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.contrib import messages
|
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.db.models import Sum
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.http import HttpRequest, JsonResponse
|
from django.http import HttpRequest
|
||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from ema.forms import NewEmaForm, EditEmaForm
|
from ema.forms import NewEmaForm, EditEmaForm
|
||||||
from ema.models import Ema
|
from ema.models import Ema
|
||||||
from ema.tables import EmaTable
|
from ema.tables import EmaTable
|
||||||
from konova.contexts import BaseContext
|
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal
|
||||||
from konova.decorators import shared_access_required, conservation_office_group_required, login_required_modal, \
|
|
||||||
uuid_required
|
|
||||||
from konova.forms import SimpleGeomForm
|
|
||||||
from konova.forms.modals import RemoveModalForm
|
from konova.forms.modals import RemoveModalForm
|
||||||
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
|
from konova.views.base import BaseIndexView, BaseIdentifierGeneratorView, BaseNewSpatialLocatedObjectFormView, \
|
||||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
BaseEditSpatialLocatedObjectFormView
|
||||||
from konova.utils.message_templates import RECORDED_BLOCKS_EDIT, IDENTIFIER_REPLACED, FORM_INVALID, \
|
from konova.views.detail import BaseDetailView
|
||||||
DO_NOT_FORGET_TO_SHARE, GEOMETRY_SIMPLIFIED
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class EmaIndexView(LoginRequiredMixin, BaseIndexView):
|
||||||
def index_view(request: HttpRequest):
|
_TAB_TITLE = _("EMAs - Overview")
|
||||||
""" Renders the index view for EMAs
|
_INDEX_TABLE_CLS = EmaTable
|
||||||
|
|
||||||
Args:
|
def _get_queryset(self):
|
||||||
request (HttpRequest): The incoming request
|
qs = Ema.objects.filter(
|
||||||
|
deleted=None,
|
||||||
Returns:
|
).order_by(
|
||||||
|
"-modified__timestamp"
|
||||||
"""
|
)
|
||||||
template = "generic_index.html"
|
return qs
|
||||||
emas = Ema.objects.filter(
|
|
||||||
deleted=None,
|
|
||||||
).order_by(
|
|
||||||
"-modified__timestamp"
|
|
||||||
)
|
|
||||||
|
|
||||||
table = EmaTable(
|
|
||||||
request,
|
|
||||||
queryset=emas
|
|
||||||
)
|
|
||||||
context = {
|
|
||||||
"table": table,
|
|
||||||
TAB_TITLE_IDENTIFIER: _("EMAs - Overview"),
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class NewEmaFormView(BaseNewSpatialLocatedObjectFormView):
|
||||||
@conservation_office_group_required
|
_FORM_CLS = NewEmaForm
|
||||||
def new_view(request: HttpRequest):
|
_MODEL_CLS = Ema
|
||||||
"""
|
_TEMPLATE = "ema/form/view.html"
|
||||||
Renders a view for a new eco account creation
|
_TAB_TITLE = _("New EMA")
|
||||||
|
_REDIRECT_URL = "ema:detail"
|
||||||
|
|
||||||
Args:
|
def _user_has_permission(self, user):
|
||||||
request (HttpRequest): The incoming request
|
# User has to be an ets user
|
||||||
|
return user.is_ets_user()
|
||||||
Returns:
|
|
||||||
|
|
||||||
"""
|
|
||||||
template = "ema/form/view.html"
|
|
||||||
data_form = NewEmaForm(request.POST or None)
|
|
||||||
geom_form = SimpleGeomForm(request.POST or None, read_only=False)
|
|
||||||
if request.method == "POST":
|
|
||||||
if data_form.is_valid() and geom_form.is_valid():
|
|
||||||
generated_identifier = data_form.cleaned_data.get("identifier", None)
|
|
||||||
ema = data_form.save(request.user, geom_form)
|
|
||||||
if generated_identifier != ema.identifier:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
IDENTIFIER_REPLACED.format(
|
|
||||||
generated_identifier,
|
|
||||||
ema.identifier
|
|
||||||
)
|
|
||||||
)
|
|
||||||
messages.success(request, _("EMA {} added").format(ema.identifier))
|
|
||||||
if geom_form.geometry_simplified:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
GEOMETRY_SIMPLIFIED
|
|
||||||
)
|
|
||||||
|
|
||||||
return redirect("ema:detail", id=ema.id)
|
|
||||||
else:
|
|
||||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
|
||||||
else:
|
|
||||||
# For clarification: nothing in this case
|
|
||||||
pass
|
|
||||||
context = {
|
|
||||||
"form": data_form,
|
|
||||||
"geom_form": geom_form,
|
|
||||||
TAB_TITLE_IDENTIFIER: _("New EMA"),
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class EditEmaFormView(BaseEditSpatialLocatedObjectFormView):
|
||||||
@conservation_office_group_required
|
_MODEL_CLS = Ema
|
||||||
def new_id_view(request: HttpRequest):
|
_FORM_CLS = EditEmaForm
|
||||||
""" JSON endpoint
|
_TEMPLATE = "ema/form/view.html"
|
||||||
|
_REDIRECT_URL = "ema:detail"
|
||||||
|
_TAB_TITLE = _("Edit {}")
|
||||||
|
|
||||||
Provides fetching of free identifiers for e.g. AJAX calls
|
def _user_has_permission(self, user):
|
||||||
|
# User has to be an ets user
|
||||||
|
return user.is_ets_user()
|
||||||
|
|
||||||
"""
|
|
||||||
tmp = Ema()
|
class EmaIdentifierGeneratorView(LoginRequiredMixin, BaseIdentifierGeneratorView):
|
||||||
identifier = tmp.generate_new_identifier()
|
_MODEL_CLS = Ema
|
||||||
while Ema.objects.filter(identifier=identifier).exists():
|
_REDIRECT_URL = "ema:index"
|
||||||
identifier = tmp.generate_new_identifier()
|
|
||||||
return JsonResponse(
|
def _user_has_permission(self, user):
|
||||||
data={
|
return user.is_ets_user()
|
||||||
"gen_data": identifier
|
|
||||||
|
|
||||||
|
class EmaDetailView(BaseDetailView):
|
||||||
|
_MODEL_CLS = Ema
|
||||||
|
_TEMPLATE = "ema/detail/view.html"
|
||||||
|
|
||||||
|
def _get_object(self, id: str):
|
||||||
|
""" Fetch object for detail view
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (str): The record's id'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
ema = get_object_or_404(Ema, id=id, deleted=None)
|
||||||
|
return ema
|
||||||
|
|
||||||
|
def _get_detail_context(self, obj: Ema):
|
||||||
|
""" Generate object specific detail context for view
|
||||||
|
|
||||||
|
Args:
|
||||||
|
obj (): The record
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
# Order states according to surface
|
||||||
|
before_states = obj.before_states.all().order_by("-surface")
|
||||||
|
after_states = obj.after_states.all().order_by("-surface")
|
||||||
|
|
||||||
|
# Precalculate logical errors between before- and after-states
|
||||||
|
# Sum() returns None in case of no states, so we catch that and replace it with 0 for easier handling
|
||||||
|
sum_before_states = obj.get_surface_before_states()
|
||||||
|
sum_after_states = obj.get_surface_after_states()
|
||||||
|
diff_states = abs(sum_before_states - sum_after_states)
|
||||||
|
|
||||||
|
context = {
|
||||||
|
"before_states": before_states,
|
||||||
|
"after_states": after_states,
|
||||||
|
"sum_before_states": sum_before_states,
|
||||||
|
"sum_after_states": sum_after_states,
|
||||||
|
"diff_states": diff_states,
|
||||||
|
"has_finished_deadlines": obj.get_finished_deadlines().exists(),
|
||||||
}
|
}
|
||||||
)
|
return context
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
@uuid_required
|
|
||||||
def detail_view(request: HttpRequest, id: str):
|
|
||||||
""" Renders the detail view of an EMA
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request (HttpRequest): The incoming request
|
|
||||||
id (str): The EMA id
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
"""
|
|
||||||
template = "ema/detail/view.html"
|
|
||||||
ema = get_object_or_404(Ema, id=id, deleted=None)
|
|
||||||
|
|
||||||
geom_form = SimpleGeomForm(instance=ema)
|
|
||||||
parcels = ema.get_underlying_parcels()
|
|
||||||
_user = request.user
|
|
||||||
is_data_shared = ema.is_shared_with(_user)
|
|
||||||
|
|
||||||
# Order states according to surface
|
|
||||||
before_states = ema.before_states.all().order_by("-surface")
|
|
||||||
after_states = ema.after_states.all().order_by("-surface")
|
|
||||||
|
|
||||||
# Precalculate logical errors between before- and after-states
|
|
||||||
# Sum() returns None in case of no states, so we catch that and replace it with 0 for easier handling
|
|
||||||
sum_before_states = ema.get_surface_before_states()
|
|
||||||
sum_after_states = ema.get_surface_after_states()
|
|
||||||
diff_states = abs(sum_before_states - sum_after_states)
|
|
||||||
|
|
||||||
ema.set_status_messages(request)
|
|
||||||
|
|
||||||
requesting_user_is_only_shared_user = ema.is_only_shared_with(_user)
|
|
||||||
if requesting_user_is_only_shared_user:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
DO_NOT_FORGET_TO_SHARE
|
|
||||||
)
|
|
||||||
|
|
||||||
context = {
|
|
||||||
"obj": ema,
|
|
||||||
"geom_form": geom_form,
|
|
||||||
"parcels": parcels,
|
|
||||||
"has_access": is_data_shared,
|
|
||||||
"before_states": before_states,
|
|
||||||
"after_states": after_states,
|
|
||||||
"sum_before_states": sum_before_states,
|
|
||||||
"sum_after_states": sum_after_states,
|
|
||||||
"diff_states": diff_states,
|
|
||||||
"is_default_member": _user.in_group(DEFAULT_GROUP),
|
|
||||||
"is_zb_member": _user.in_group(ZB_GROUP),
|
|
||||||
"is_ets_member": _user.in_group(ETS_GROUP),
|
|
||||||
"LANIS_LINK": ema.get_LANIS_link(),
|
|
||||||
TAB_TITLE_IDENTIFIER: f"{ema.identifier} - {ema.title}",
|
|
||||||
"has_finished_deadlines": ema.get_finished_deadlines().exists(),
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
@conservation_office_group_required
|
|
||||||
@shared_access_required(Ema, "id")
|
|
||||||
def edit_view(request: HttpRequest, id: str):
|
|
||||||
"""
|
|
||||||
Renders a view for editing compensations
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request (HttpRequest): The incoming request
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
"""
|
|
||||||
template = "compensation/form/view.html"
|
|
||||||
# Get object from db
|
|
||||||
ema = get_object_or_404(Ema, id=id)
|
|
||||||
if ema.is_recorded:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
RECORDED_BLOCKS_EDIT
|
|
||||||
)
|
|
||||||
return redirect("ema:detail", id=id)
|
|
||||||
|
|
||||||
# Create forms, initialize with values from db/from POST request
|
|
||||||
data_form = EditEmaForm(request.POST or None, instance=ema)
|
|
||||||
geom_form = SimpleGeomForm(request.POST or None, read_only=False, instance=ema)
|
|
||||||
if request.method == "POST":
|
|
||||||
if data_form.is_valid() and geom_form.is_valid():
|
|
||||||
# The data form takes the geom form for processing, as well as the performing user
|
|
||||||
ema = data_form.save(request.user, geom_form)
|
|
||||||
messages.success(request, _("EMA {} edited").format(ema.identifier))
|
|
||||||
if geom_form.geometry_simplified:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
GEOMETRY_SIMPLIFIED
|
|
||||||
)
|
|
||||||
return redirect("ema:detail", id=ema.id)
|
|
||||||
else:
|
|
||||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
|
||||||
else:
|
|
||||||
# For clarification: nothing in this case
|
|
||||||
pass
|
|
||||||
context = {
|
|
||||||
"form": data_form,
|
|
||||||
"geom_form": geom_form,
|
|
||||||
TAB_TITLE_IDENTIFIER: _("Edit {}").format(ema.identifier),
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required_modal
|
@login_required_modal
|
||||||
|
|||||||
@@ -5,76 +5,36 @@ Contact: ksp-servicestelle@sgdnord.rlp.de
|
|||||||
Created on: 19.08.22
|
Created on: 19.08.22
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.http import HttpRequest
|
|
||||||
from django.shortcuts import get_object_or_404, render
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
|
|
||||||
|
from compensation.views.compensation.report import BaseCompensationReportView
|
||||||
from ema.models import Ema
|
from ema.models import Ema
|
||||||
from konova.contexts import BaseContext
|
from konova.sub_settings.django_settings import BASE_URL
|
||||||
from konova.forms import SimpleGeomForm
|
from konova.utils.qrcode import QrCode
|
||||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
|
||||||
from konova.utils.generators import generate_qr_code
|
|
||||||
|
|
||||||
|
|
||||||
def report_view(request:HttpRequest, id: str):
|
class EmaReportView(BaseCompensationReportView):
|
||||||
""" Renders the public report view
|
_TEMPLATE = "ema/report/report.html"
|
||||||
|
_MODEL = Ema
|
||||||
|
|
||||||
Args:
|
def _get_report_context(self, obj):
|
||||||
request (HttpRequest): The incoming request
|
report_url = BASE_URL + reverse("ema:report", args=(obj.id,))
|
||||||
id (str): The id of the intervention
|
qrcode_report = QrCode(report_url, 10)
|
||||||
|
qrcode_lanis = QrCode(obj.get_LANIS_link(), 7)
|
||||||
|
|
||||||
Returns:
|
generic_compensation_report_context = self._get_compensation_report_context(obj)
|
||||||
|
|
||||||
"""
|
report_context = {
|
||||||
# Reuse the compensation report template since EMAs are structurally identical
|
"qrcode": {
|
||||||
template = "ema/report/report.html"
|
"img": qrcode_report.get_img(),
|
||||||
ema = get_object_or_404(Ema, id=id)
|
"url": qrcode_report.get_content(),
|
||||||
|
},
|
||||||
tab_title = _("Report {}").format(ema.identifier)
|
"qrcode_lanis": {
|
||||||
# If intervention is not recorded (yet or currently) we need to render another template without any data
|
"img": qrcode_lanis.get_img(),
|
||||||
if not ema.is_ready_for_publish():
|
"url": qrcode_lanis.get_content(),
|
||||||
template = "report/unavailable.html"
|
},
|
||||||
context = {
|
"is_entry_shared": False, # disables action buttons during rendering
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
"tables_scrollable": False,
|
||||||
}
|
}
|
||||||
context = BaseContext(request, context).context
|
report_context.update(generic_compensation_report_context)
|
||||||
return render(request, template, context)
|
return report_context
|
||||||
|
|
||||||
# Prepare data for map viewer
|
|
||||||
geom_form = SimpleGeomForm(
|
|
||||||
instance=ema,
|
|
||||||
)
|
|
||||||
parcels = ema.get_underlying_parcels()
|
|
||||||
|
|
||||||
qrcode_url = request.build_absolute_uri(reverse("ema:report", args=(id,)))
|
|
||||||
qrcode_img = generate_qr_code(qrcode_url, 10)
|
|
||||||
qrcode_lanis_url = ema.get_LANIS_link()
|
|
||||||
qrcode_img_lanis = generate_qr_code(qrcode_lanis_url, 7)
|
|
||||||
|
|
||||||
# Order states by surface
|
|
||||||
before_states = ema.before_states.all().order_by("-surface").prefetch_related("biotope_type")
|
|
||||||
after_states = ema.after_states.all().order_by("-surface").prefetch_related("biotope_type")
|
|
||||||
actions = ema.actions.all().prefetch_related("action_type")
|
|
||||||
|
|
||||||
context = {
|
|
||||||
"obj": ema,
|
|
||||||
"qrcode": {
|
|
||||||
"img": qrcode_img,
|
|
||||||
"url": qrcode_url
|
|
||||||
},
|
|
||||||
"qrcode_lanis": {
|
|
||||||
"img": qrcode_img_lanis,
|
|
||||||
"url": qrcode_lanis_url
|
|
||||||
},
|
|
||||||
"has_access": False, # disables action buttons during rendering
|
|
||||||
"before_states": before_states,
|
|
||||||
"after_states": after_states,
|
|
||||||
"geom_form": geom_form,
|
|
||||||
"parcels": parcels,
|
|
||||||
"actions": actions,
|
|
||||||
"tables_scrollable": False,
|
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<a href="{% url 'compensation:new' obj.id %}" title="{% trans 'Add new compensation' %}">
|
<a href="{% url 'compensation:new' obj.id %}" title="{% trans 'Add new compensation' %}">
|
||||||
<button class="btn btn-outline-default">
|
<button class="btn btn-outline-default">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Title' %}
|
{% trans 'Title' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="align-middle">{{ comp.title }}</td>
|
<td class="align-middle">{{ comp.title }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'intervention:remove-compensation' obj.id comp.id %}" class="btn btn-default btn-modal float-right" title="{% trans 'Remove compensation' %}">
|
<button data-form-url="{% url 'intervention:remove-compensation' obj.id comp.id %}" class="btn btn-default btn-modal float-right" title="{% trans 'Remove compensation' %}">
|
||||||
{% fa5_icon 'trash' %}
|
{% fa5_icon 'trash' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
{% fa5_icon 'file-alt' %}
|
{% fa5_icon 'file-alt' %}
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
{% if has_access %}
|
{% if is_entry_shared %}
|
||||||
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Resubmission' %}" data-form-url="{% url 'intervention:resubmission-create' obj.id %}">
|
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Resubmission' %}" data-form-url="{% url 'intervention:resubmission-create' obj.id %}">
|
||||||
{% fa5_icon 'bell' %}
|
{% fa5_icon 'bell' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-deduction' obj.id %}" title="{% trans 'Add new deduction' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-deduction' obj.id %}" title="{% trans 'Add new deduction' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'tree' %}
|
{% fa5_icon 'tree' %}
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Created' %}
|
{% trans 'Created' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
<td class="align-middle">{{ deduction.surface|floatformat:2|intcomma }} m²</td>
|
<td class="align-middle">{{ deduction.surface|floatformat:2|intcomma }} m²</td>
|
||||||
<td class="align-middle">{{ deduction.created.timestamp|default_if_none:""|naturalday}}</td>
|
<td class="align-middle">{{ deduction.created.timestamp|default_if_none:""|naturalday}}</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'intervention:edit-deduction' obj.id deduction.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit Deduction' %}">
|
<button data-form-url="{% url 'intervention:edit-deduction' obj.id deduction.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit Deduction' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'file' %}
|
{% fa5_icon 'file' %}
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Comment' %}
|
{% trans 'Comment' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'intervention:edit-doc' obj.id doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit document' %}">
|
<button data-form-url="{% url 'intervention:edit-doc' obj.id doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit document' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:pay:new' obj.id %}" title="{% trans 'Add new payment' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:pay:new' obj.id %}" title="{% trans 'Add new payment' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'money-bill-wave' %}
|
{% fa5_icon 'money-bill-wave' %}
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<th class="w-50" scope="col">
|
<th class="w-50" scope="col">
|
||||||
{% trans 'Comment' %}
|
{% trans 'Comment' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -46,16 +46,24 @@
|
|||||||
{% for pay in obj.payments.all %}
|
{% for pay in obj.payments.all %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
{{ pay.amount|floatformat:2 }} €
|
{% if is_entry_shared %}
|
||||||
|
{{ pay.amount|floatformat:2 }} €
|
||||||
|
{% else %}
|
||||||
|
***
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle">{{ pay.due_on|default_if_none:"---" }}</td>
|
<td class="align-middle">{{ pay.due_on|default_if_none:"---" }}</td>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
<div class="scroll-150">
|
<div class="scroll-150">
|
||||||
{{ pay.comment }}
|
{% if is_entry_shared %}
|
||||||
|
{{ pay.comment }}
|
||||||
|
{% else %}
|
||||||
|
{% trans 'This data is not shared with you' %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'compensation:pay:edit' obj.id pay.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit payment' %}">
|
<button data-form-url="{% url 'compensation:pay:edit' obj.id pay.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit payment' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
{% comment %}
|
{% comment %}
|
||||||
Only show add-button if no revocation exists, yet.
|
Only show add-button if no revocation exists, yet.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
{% if is_default_member and has_access and not obj.legal.revocation %}
|
{% if is_default_member and is_entry_shared and not obj.legal.revocation %}
|
||||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-revocation' obj.id %}" title="{% trans 'Add revocation' %}">
|
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-revocation' obj.id %}" title="{% trans 'Add revocation' %}">
|
||||||
{% fa5_icon 'plus' %}
|
{% fa5_icon 'plus' %}
|
||||||
{% fa5_icon 'ban' %}
|
{% fa5_icon 'ban' %}
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% trans 'Comment' %}
|
{% trans 'Comment' %}
|
||||||
</th>
|
</th>
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<th class="w-10" scope="col">
|
<th class="w-10" scope="col">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
{% trans 'Action' %}
|
{% trans 'Action' %}
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle float-right">
|
<td class="align-middle float-right">
|
||||||
{% if is_default_member and has_access %}
|
{% if is_default_member and is_entry_shared %}
|
||||||
<button data-form-url="{% url 'intervention:edit-revocation' obj.id rev.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit revocation' %}">
|
<button data-form-url="{% url 'intervention:edit-revocation' obj.id rev.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit revocation' %}">
|
||||||
{% fa5_icon 'edit' %}
|
{% fa5_icon 'edit' %}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
{% include 'user/includes/team_data_modal_button.html' %}
|
{% include 'user/includes/team_data_modal_button.html' %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<hr>
|
<hr>
|
||||||
{% if has_access %}
|
{% if is_entry_shared %}
|
||||||
{% for user in obj.users.all %}
|
{% for user in obj.users.all %}
|
||||||
{% include 'user/includes/contact_modal_button.html' %}
|
{% include 'user/includes/contact_modal_button.html' %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
post_data = {
|
post_data = {
|
||||||
"identifier": test_id,
|
"identifier": test_id,
|
||||||
"title": test_title,
|
"title": test_title,
|
||||||
"geom": geom_json,
|
"output": geom_json,
|
||||||
}
|
}
|
||||||
response = self.client_user.post(
|
response = self.client_user.post(
|
||||||
new_url,
|
new_url,
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class NewInterventionFormTestCase(BaseTestCase):
|
|||||||
)
|
)
|
||||||
geom_form_data = json.loads(geom_form_data)
|
geom_form_data = json.loads(geom_form_data)
|
||||||
geom_form_data = {
|
geom_form_data = {
|
||||||
"geom": json.dumps(geom_form_data)
|
"output": json.dumps(geom_form_data)
|
||||||
}
|
}
|
||||||
geom_form = SimpleGeomForm(geom_form_data)
|
geom_form = SimpleGeomForm(geom_form_data)
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ class EditInterventionFormTestCase(NewInterventionFormTestCase):
|
|||||||
)
|
)
|
||||||
geom_form_data = json.loads(geom_form_data)
|
geom_form_data = json.loads(geom_form_data)
|
||||||
geom_form_data = {
|
geom_form_data = {
|
||||||
"geom": json.dumps(geom_form_data)
|
"output": json.dumps(geom_form_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
geom_form = SimpleGeomForm(geom_form_data)
|
geom_form = SimpleGeomForm(geom_form_data)
|
||||||
@@ -124,7 +124,7 @@ class EditInterventionFormTestCase(NewInterventionFormTestCase):
|
|||||||
self.assertIsNotNone(obj.responsible.handler)
|
self.assertIsNotNone(obj.responsible.handler)
|
||||||
self.assertEqual(obj.title, data["title"])
|
self.assertEqual(obj.title, data["title"])
|
||||||
self.assertEqual(obj.comment, data["comment"])
|
self.assertEqual(obj.comment, data["comment"])
|
||||||
self.assertTrue(test_geom.equals_exact(obj.geometry.geom, 0.000001))
|
self.assert_equal_geometries(test_geom, obj.geometry.geom)
|
||||||
|
|
||||||
self.assertEqual(obj.legal.binding_date, today)
|
self.assertEqual(obj.legal.binding_date, today)
|
||||||
self.assertEqual(obj.legal.registration_date, today)
|
self.assertEqual(obj.legal.registration_date, today)
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ from intervention.views.deduction import NewInterventionDeductionView, EditInter
|
|||||||
RemoveInterventionDeductionView
|
RemoveInterventionDeductionView
|
||||||
from intervention.views.document import NewInterventionDocumentView, GetInterventionDocumentView, \
|
from intervention.views.document import NewInterventionDocumentView, GetInterventionDocumentView, \
|
||||||
RemoveInterventionDocumentView, EditInterventionDocumentView
|
RemoveInterventionDocumentView, EditInterventionDocumentView
|
||||||
from intervention.views.intervention import index_view, new_view, new_id_view, detail_view, edit_view, remove_view
|
from intervention.views.intervention import remove_view, \
|
||||||
|
InterventionIndexView, InterventionIdentifierGeneratorView, InterventionDetailView, NewInterventionFormView, \
|
||||||
|
EditInterventionFormView
|
||||||
from intervention.views.log import InterventionLogView
|
from intervention.views.log import InterventionLogView
|
||||||
from intervention.views.record import InterventionRecordView
|
from intervention.views.record import InterventionRecordView
|
||||||
from intervention.views.report import report_view
|
from intervention.views.report import InterventionReportView
|
||||||
from intervention.views.resubmission import InterventionResubmissionView
|
from intervention.views.resubmission import InterventionResubmissionView
|
||||||
from intervention.views.revocation import new_revocation_view, edit_revocation_view, remove_revocation_view, \
|
from intervention.views.revocation import new_revocation_view, edit_revocation_view, remove_revocation_view, \
|
||||||
get_revocation_view
|
get_revocation_view
|
||||||
@@ -25,18 +27,18 @@ from intervention.views.share import InterventionShareFormView, InterventionShar
|
|||||||
|
|
||||||
app_name = "intervention"
|
app_name = "intervention"
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", index_view, name="index"),
|
path("", InterventionIndexView.as_view(), name="index"),
|
||||||
path('new/', new_view, name='new'),
|
path('new/', NewInterventionFormView.as_view(), name='new'),
|
||||||
path('new/id', new_id_view, name='new-id'),
|
path('new/id', InterventionIdentifierGeneratorView.as_view(), name='new-id'),
|
||||||
path('<id>', detail_view, name='detail'),
|
path('<id>', InterventionDetailView.as_view(), name='detail'),
|
||||||
path('<id>/log', InterventionLogView.as_view(), name='log'),
|
path('<id>/log', InterventionLogView.as_view(), name='log'),
|
||||||
path('<id>/edit', edit_view, name='edit'),
|
path('<id>/edit', EditInterventionFormView.as_view(), name='edit'),
|
||||||
path('<id>/remove', remove_view, name='remove'),
|
path('<id>/remove', remove_view, name='remove'),
|
||||||
path('<id>/share/<token>', InterventionShareByTokenView.as_view(), name='share-token'),
|
path('<id>/share/<token>', InterventionShareByTokenView.as_view(), name='share-token'),
|
||||||
path('<id>/share', InterventionShareFormView.as_view(), name='share-form'),
|
path('<id>/share', InterventionShareFormView.as_view(), name='share-form'),
|
||||||
path('<id>/check', check_view, name='check'),
|
path('<id>/check', check_view, name='check'),
|
||||||
path('<id>/record', InterventionRecordView.as_view(), name='record'),
|
path('<id>/record', InterventionRecordView.as_view(), name='record'),
|
||||||
path('<id>/report', report_view, name='report'),
|
path('<id>/report', InterventionReportView.as_view(), name='report'),
|
||||||
path('<id>/resub', InterventionResubmissionView.as_view(), name='resubmission-create'),
|
path('<id>/resub', InterventionResubmissionView.as_view(), name='resubmission-create'),
|
||||||
|
|
||||||
# Compensations
|
# Compensations
|
||||||
|
|||||||
@@ -5,51 +5,22 @@ Contact: ksp-servicestelle@sgdnord.rlp.de
|
|||||||
Created on: 19.08.22
|
Created on: 19.08.22
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.utils.decorators import method_decorator
|
|
||||||
|
|
||||||
from intervention.models import Intervention
|
from intervention.models import Intervention
|
||||||
from konova.decorators import default_group_required, shared_access_required
|
|
||||||
from konova.views.deduction import AbstractNewDeductionView, AbstractEditDeductionView, AbstractRemoveDeductionView
|
from konova.views.deduction import AbstractNewDeductionView, AbstractEditDeductionView, AbstractRemoveDeductionView
|
||||||
|
|
||||||
|
|
||||||
class NewInterventionDeductionView(AbstractNewDeductionView):
|
class NewInterventionDeductionView(LoginRequiredMixin, AbstractNewDeductionView):
|
||||||
def _custom_check(self, obj):
|
_MODEL = Intervention
|
||||||
pass
|
_REDIRECT_URL = "intervention:detail"
|
||||||
|
|
||||||
model = Intervention
|
|
||||||
redirect_url = "intervention:detail"
|
|
||||||
|
|
||||||
@method_decorator(login_required)
|
|
||||||
@method_decorator(default_group_required)
|
|
||||||
@method_decorator(shared_access_required(Intervention, "id"))
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
|
||||||
return super().dispatch(request, *args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class EditInterventionDeductionView(AbstractEditDeductionView):
|
class EditInterventionDeductionView(LoginRequiredMixin, AbstractEditDeductionView):
|
||||||
def _custom_check(self, obj):
|
_MODEL = Intervention
|
||||||
pass
|
_REDIRECT_URL = "intervention:detail"
|
||||||
|
|
||||||
model = Intervention
|
|
||||||
redirect_url = "intervention:detail"
|
|
||||||
|
|
||||||
@method_decorator(login_required)
|
|
||||||
@method_decorator(default_group_required)
|
|
||||||
@method_decorator(shared_access_required(Intervention, "id"))
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
|
||||||
return super().dispatch(request, *args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class RemoveInterventionDeductionView(AbstractRemoveDeductionView):
|
class RemoveInterventionDeductionView(LoginRequiredMixin, AbstractRemoveDeductionView):
|
||||||
def _custom_check(self, obj):
|
_MODEL = Intervention
|
||||||
pass
|
_REDIRECT_URL = "intervention:detail"
|
||||||
|
|
||||||
model = Intervention
|
|
||||||
redirect_url = "intervention:detail"
|
|
||||||
|
|
||||||
@method_decorator(login_required)
|
|
||||||
@method_decorator(default_group_required)
|
|
||||||
@method_decorator(shared_access_required(Intervention, "id"))
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
|
||||||
return super().dispatch(request, *args, **kwargs)
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ Created on: 19.08.22
|
|||||||
"""
|
"""
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.http import JsonResponse, HttpRequest
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
|
from django.http import HttpRequest
|
||||||
from django.shortcuts import get_object_or_404, render, redirect
|
from django.shortcuts import get_object_or_404, render, redirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@@ -16,189 +17,106 @@ from intervention.forms.intervention import EditInterventionForm, NewInterventio
|
|||||||
from intervention.models import Intervention
|
from intervention.models import Intervention
|
||||||
from intervention.tables import InterventionTable
|
from intervention.tables import InterventionTable
|
||||||
from konova.contexts import BaseContext
|
from konova.contexts import BaseContext
|
||||||
from konova.decorators import default_group_required, shared_access_required, any_group_check, login_required_modal, \
|
from konova.decorators import default_group_required, shared_access_required, login_required_modal
|
||||||
uuid_required
|
|
||||||
from konova.forms import SimpleGeomForm
|
from konova.forms import SimpleGeomForm
|
||||||
from konova.forms.modals import RemoveModalForm
|
from konova.forms.modals import RemoveModalForm
|
||||||
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
|
|
||||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||||
from konova.utils.message_templates import DATA_CHECKED_PREVIOUSLY_TEMPLATE, RECORDED_BLOCKS_EDIT, \
|
from konova.utils.message_templates import DATA_CHECKED_PREVIOUSLY_TEMPLATE, RECORDED_BLOCKS_EDIT, \
|
||||||
CHECK_STATE_RESET, FORM_INVALID, IDENTIFIER_REPLACED, DO_NOT_FORGET_TO_SHARE, GEOMETRY_SIMPLIFIED
|
CHECK_STATE_RESET, FORM_INVALID, GEOMETRY_SIMPLIFIED, GEOMETRIES_IGNORED_TEMPLATE
|
||||||
|
from konova.views.base import BaseIndexView, BaseIdentifierGeneratorView, BaseNewSpatialLocatedObjectFormView, \
|
||||||
|
BaseEditSpatialLocatedObjectFormView
|
||||||
|
from konova.views.detail import BaseDetailView
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class InterventionIndexView(LoginRequiredMixin, BaseIndexView):
|
||||||
@any_group_check
|
_INDEX_TABLE_CLS = InterventionTable
|
||||||
def index_view(request: HttpRequest):
|
_TAB_TITLE = _("Interventions - Overview")
|
||||||
"""
|
|
||||||
Renders the index view for Interventions
|
|
||||||
|
|
||||||
Args:
|
def _get_queryset(self):
|
||||||
request (HttpRequest): The incoming request
|
qs = Intervention.objects.filter(
|
||||||
|
deleted=None,
|
||||||
Returns:
|
).select_related(
|
||||||
A rendered view
|
"legal"
|
||||||
"""
|
).order_by(
|
||||||
template = "generic_index.html"
|
"-modified__timestamp"
|
||||||
|
)
|
||||||
# Filtering by user access is performed in table filter inside InterventionTableFilter class
|
return qs
|
||||||
interventions = Intervention.objects.filter(
|
|
||||||
deleted=None, # not deleted
|
|
||||||
).select_related(
|
|
||||||
"legal"
|
|
||||||
).order_by(
|
|
||||||
"-modified__timestamp"
|
|
||||||
)
|
|
||||||
table = InterventionTable(
|
|
||||||
request=request,
|
|
||||||
queryset=interventions
|
|
||||||
)
|
|
||||||
context = {
|
|
||||||
"table": table,
|
|
||||||
TAB_TITLE_IDENTIFIER: _("Interventions - Overview"),
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class NewInterventionFormView(BaseNewSpatialLocatedObjectFormView):
|
||||||
@default_group_required
|
_MODEL_CLS = Intervention
|
||||||
def new_view(request: HttpRequest):
|
_FORM_CLS = NewInterventionForm
|
||||||
"""
|
_TEMPLATE = "intervention/form/view.html"
|
||||||
Renders a view for a new intervention creation
|
_REDIRECT_URL = "intervention:detail"
|
||||||
|
_TAB_TITLE = _("New intervention")
|
||||||
Args:
|
|
||||||
request (HttpRequest): The incoming request
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
"""
|
|
||||||
template = "intervention/form/view.html"
|
|
||||||
data_form = NewInterventionForm(request.POST or None)
|
|
||||||
geom_form = SimpleGeomForm(request.POST or None, read_only=False)
|
|
||||||
if request.method == "POST":
|
|
||||||
if data_form.is_valid() and geom_form.is_valid():
|
|
||||||
generated_identifier = data_form.cleaned_data.get("identifier", None)
|
|
||||||
intervention = data_form.save(request.user, geom_form)
|
|
||||||
if generated_identifier != intervention.identifier:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
IDENTIFIER_REPLACED.format(
|
|
||||||
generated_identifier,
|
|
||||||
intervention.identifier
|
|
||||||
)
|
|
||||||
)
|
|
||||||
messages.success(request, _("Intervention {} added").format(intervention.identifier))
|
|
||||||
if geom_form.geometry_simplified:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
GEOMETRY_SIMPLIFIED
|
|
||||||
)
|
|
||||||
return redirect("intervention:detail", id=intervention.id)
|
|
||||||
else:
|
|
||||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
|
||||||
else:
|
|
||||||
# For clarification: nothing in this case
|
|
||||||
pass
|
|
||||||
context = {
|
|
||||||
"form": data_form,
|
|
||||||
"geom_form": geom_form,
|
|
||||||
TAB_TITLE_IDENTIFIER: _("New intervention"),
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class EditInterventionFormView(BaseEditSpatialLocatedObjectFormView):
|
||||||
@default_group_required
|
_MODEL_CLS = Intervention
|
||||||
def new_id_view(request: HttpRequest):
|
_FORM_CLS = EditInterventionForm
|
||||||
""" JSON endpoint
|
_TEMPLATE = "intervention/form/view.html"
|
||||||
|
_REDIRECT_URL = "intervention:detail"
|
||||||
|
_TAB_TITLE = _("Edit {}")
|
||||||
|
|
||||||
Provides fetching of free identifiers for e.g. AJAX calls
|
|
||||||
|
|
||||||
"""
|
class InterventionIdentifierGeneratorView(LoginRequiredMixin, BaseIdentifierGeneratorView):
|
||||||
tmp_intervention = Intervention()
|
_MODEL_CLS = Intervention
|
||||||
identifier = tmp_intervention.generate_new_identifier()
|
_REDIRECT_URL = "intervention:index"
|
||||||
while Intervention.objects.filter(identifier=identifier).exists():
|
|
||||||
identifier = tmp_intervention.generate_new_identifier()
|
|
||||||
return JsonResponse(
|
class InterventionDetailView(BaseDetailView):
|
||||||
data={
|
_MODEL_CLS = Intervention
|
||||||
"gen_data": identifier
|
_TEMPLATE = "intervention/detail/view.html"
|
||||||
|
|
||||||
|
def _get_object(self, id: str):
|
||||||
|
""" Returns the intervention
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (str): The intervention's id
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
obj (Intervention): The intervention
|
||||||
|
"""
|
||||||
|
# Fetch data, filter out deleted related data
|
||||||
|
obj = get_object_or_404(
|
||||||
|
self._MODEL_CLS.objects.select_related(
|
||||||
|
"geometry",
|
||||||
|
"legal",
|
||||||
|
"responsible",
|
||||||
|
).prefetch_related(
|
||||||
|
"legal__revocations",
|
||||||
|
),
|
||||||
|
id=id,
|
||||||
|
deleted=None
|
||||||
|
)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
def _get_detail_context(self, obj: Intervention):
|
||||||
|
""" Generate object specific detail context for view
|
||||||
|
|
||||||
|
Args:
|
||||||
|
obj (): The record
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
compensations = obj.compensations.filter(deleted=None)
|
||||||
|
last_checked = obj.get_last_checked_action()
|
||||||
|
last_checked_tooltip = ""
|
||||||
|
if last_checked:
|
||||||
|
last_checked_tooltip = DATA_CHECKED_PREVIOUSLY_TEMPLATE.format(
|
||||||
|
last_checked.get_timestamp_str_formatted(),
|
||||||
|
last_checked.user
|
||||||
|
)
|
||||||
|
|
||||||
|
has_payment_without_document = obj.payments.exists() and not obj.get_documents()[1].exists()
|
||||||
|
context = {
|
||||||
|
"last_checked": last_checked,
|
||||||
|
"last_checked_tooltip": last_checked_tooltip,
|
||||||
|
"compensations": compensations,
|
||||||
|
"has_payment_without_document": has_payment_without_document,
|
||||||
}
|
}
|
||||||
)
|
return context
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
@any_group_check
|
|
||||||
@uuid_required
|
|
||||||
def detail_view(request: HttpRequest, id: str):
|
|
||||||
""" Renders a detail view for viewing an intervention's data
|
|
||||||
|
|
||||||
Args:
|
|
||||||
request (HttpRequest): The incoming request
|
|
||||||
id (str): The intervention's id
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
"""
|
|
||||||
template = "intervention/detail/view.html"
|
|
||||||
|
|
||||||
# Fetch data, filter out deleted related data
|
|
||||||
intervention = get_object_or_404(
|
|
||||||
Intervention.objects.select_related(
|
|
||||||
"geometry",
|
|
||||||
"legal",
|
|
||||||
"responsible",
|
|
||||||
).prefetch_related(
|
|
||||||
"legal__revocations",
|
|
||||||
),
|
|
||||||
id=id,
|
|
||||||
deleted=None
|
|
||||||
)
|
|
||||||
compensations = intervention.compensations.filter(
|
|
||||||
deleted=None,
|
|
||||||
)
|
|
||||||
_user = request.user
|
|
||||||
is_data_shared = intervention.is_shared_with(user=_user)
|
|
||||||
|
|
||||||
geom_form = SimpleGeomForm(
|
|
||||||
instance=intervention,
|
|
||||||
)
|
|
||||||
last_checked = intervention.get_last_checked_action()
|
|
||||||
last_checked_tooltip = ""
|
|
||||||
if last_checked:
|
|
||||||
last_checked_tooltip = DATA_CHECKED_PREVIOUSLY_TEMPLATE.format(
|
|
||||||
last_checked.get_timestamp_str_formatted(),
|
|
||||||
last_checked.user
|
|
||||||
)
|
|
||||||
|
|
||||||
has_payment_without_document = intervention.payments.exists() and not intervention.get_documents()[1].exists()
|
|
||||||
|
|
||||||
requesting_user_is_only_shared_user = intervention.is_only_shared_with(_user)
|
|
||||||
if requesting_user_is_only_shared_user:
|
|
||||||
messages.info(
|
|
||||||
request,
|
|
||||||
DO_NOT_FORGET_TO_SHARE
|
|
||||||
)
|
|
||||||
|
|
||||||
context = {
|
|
||||||
"obj": intervention,
|
|
||||||
"last_checked": last_checked,
|
|
||||||
"last_checked_tooltip": last_checked_tooltip,
|
|
||||||
"compensations": compensations,
|
|
||||||
"has_access": is_data_shared,
|
|
||||||
"geom_form": geom_form,
|
|
||||||
"is_default_member": _user.in_group(DEFAULT_GROUP),
|
|
||||||
"is_zb_member": _user.in_group(ZB_GROUP),
|
|
||||||
"is_ets_member": _user.in_group(ETS_GROUP),
|
|
||||||
"LANIS_LINK": intervention.get_LANIS_link(),
|
|
||||||
"has_payment_without_document": has_payment_without_document,
|
|
||||||
TAB_TITLE_IDENTIFIER: f"{intervention.identifier} - {intervention.title}",
|
|
||||||
}
|
|
||||||
|
|
||||||
request = intervention.set_status_messages(request)
|
|
||||||
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@@ -236,11 +154,19 @@ def edit_view(request: HttpRequest, id: str):
|
|||||||
messages.success(request, _("Intervention {} edited").format(intervention.identifier))
|
messages.success(request, _("Intervention {} edited").format(intervention.identifier))
|
||||||
if intervention_is_checked:
|
if intervention_is_checked:
|
||||||
messages.info(request, CHECK_STATE_RESET)
|
messages.info(request, CHECK_STATE_RESET)
|
||||||
if geom_form.geometry_simplified:
|
if geom_form.has_geometry_simplified():
|
||||||
messages.info(
|
messages.info(
|
||||||
request,
|
request,
|
||||||
GEOMETRY_SIMPLIFIED
|
GEOMETRY_SIMPLIFIED
|
||||||
)
|
)
|
||||||
|
|
||||||
|
num_ignored_geometries = geom_form.get_num_geometries_ignored()
|
||||||
|
if num_ignored_geometries > 0:
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
GEOMETRIES_IGNORED_TEMPLATE.format(num_ignored_geometries)
|
||||||
|
)
|
||||||
|
|
||||||
return redirect("intervention:detail", id=intervention.id)
|
return redirect("intervention:detail", id=intervention.id)
|
||||||
else:
|
else:
|
||||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
||||||
|
|||||||
@@ -5,72 +5,41 @@ Contact: ksp-servicestelle@sgdnord.rlp.de
|
|||||||
Created on: 19.08.22
|
Created on: 19.08.22
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.http import HttpRequest
|
|
||||||
from django.shortcuts import get_object_or_404, render
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
|
|
||||||
from intervention.models import Intervention
|
from intervention.models import Intervention
|
||||||
from konova.contexts import BaseContext
|
from konova.sub_settings.django_settings import BASE_URL
|
||||||
from konova.decorators import uuid_required
|
from konova.utils.qrcode import QrCode
|
||||||
from konova.forms import SimpleGeomForm
|
from konova.views.report import BaseReportView
|
||||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
|
||||||
from konova.utils.generators import generate_qr_code
|
|
||||||
|
|
||||||
|
|
||||||
@uuid_required
|
class InterventionReportView(BaseReportView):
|
||||||
def report_view(request: HttpRequest, id: str):
|
_TEMPLATE = 'intervention/report/report.html'
|
||||||
""" Renders the public report view
|
_MODEL = Intervention
|
||||||
|
|
||||||
Args:
|
def _get_report_context(self, obj: Intervention):
|
||||||
request (HttpRequest): The incoming request
|
""" Returns the specific context needed for an intervention report
|
||||||
id (str): The id of the intervention
|
|
||||||
|
|
||||||
Returns:
|
Args:
|
||||||
|
obj (Intervention): The object for the report
|
||||||
|
|
||||||
"""
|
Returns:
|
||||||
template = "intervention/report/report.html"
|
dict: The object specific context for rendering the report
|
||||||
intervention = get_object_or_404(Intervention, id=id)
|
"""
|
||||||
|
distinct_deductions = obj.deductions.all().distinct("account")
|
||||||
|
report_url = BASE_URL + reverse("intervention:report", args=(obj.id,))
|
||||||
|
qrcode_report = QrCode(report_url, 10)
|
||||||
|
qrcode_lanis = QrCode(obj.get_LANIS_link(), 7)
|
||||||
|
|
||||||
tab_title = _("Report {}").format(intervention.identifier)
|
return {
|
||||||
# If intervention is not recorded (yet or currently) we need to render another template without any data
|
"deductions": distinct_deductions,
|
||||||
if not intervention.is_ready_for_publish():
|
"qrcode": {
|
||||||
template = "report/unavailable.html"
|
"img": qrcode_report.get_img(),
|
||||||
context = {
|
"url": qrcode_report.get_content(),
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
},
|
||||||
|
"qrcode_lanis": {
|
||||||
|
"img": qrcode_lanis.get_img(),
|
||||||
|
"url": qrcode_lanis.get_content(),
|
||||||
|
},
|
||||||
|
"tables_scrollable": False,
|
||||||
}
|
}
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|
||||||
# Prepare data for map viewer
|
|
||||||
geom_form = SimpleGeomForm(
|
|
||||||
instance=intervention
|
|
||||||
)
|
|
||||||
parcels = intervention.get_underlying_parcels()
|
|
||||||
|
|
||||||
distinct_deductions = intervention.deductions.all().distinct(
|
|
||||||
"account"
|
|
||||||
)
|
|
||||||
qrcode_url = request.build_absolute_uri(reverse("intervention:report", args=(id,)))
|
|
||||||
qrcode_img = generate_qr_code(qrcode_url, 10)
|
|
||||||
qrcode_lanis_url = intervention.get_LANIS_link()
|
|
||||||
qrcode_img_lanis = generate_qr_code(qrcode_lanis_url, 7)
|
|
||||||
|
|
||||||
context = {
|
|
||||||
"obj": intervention,
|
|
||||||
"deductions": distinct_deductions,
|
|
||||||
"qrcode": {
|
|
||||||
"img": qrcode_img,
|
|
||||||
"url": qrcode_url,
|
|
||||||
},
|
|
||||||
"qrcode_lanis": {
|
|
||||||
"img": qrcode_img_lanis,
|
|
||||||
"url": qrcode_lanis_url,
|
|
||||||
},
|
|
||||||
"geom_form": geom_form,
|
|
||||||
"parcels": parcels,
|
|
||||||
"tables_scrollable": False,
|
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
|
||||||
}
|
|
||||||
context = BaseContext(request, context).context
|
|
||||||
return render(request, template, context)
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from uuid import UUID
|
|||||||
|
|
||||||
from bootstrap_modal_forms.mixins import is_ajax
|
from bootstrap_modal_forms.mixins import is_ajax
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.http import Http404
|
from django.core.exceptions import BadRequest
|
||||||
from django.shortcuts import redirect, get_object_or_404, render
|
from django.shortcuts import redirect, get_object_or_404, render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@@ -185,7 +185,7 @@ def uuid_required(function):
|
|||||||
try:
|
try:
|
||||||
uuid = UUID(uuid)
|
uuid = UUID(uuid)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise Http404(
|
raise BadRequest(
|
||||||
"Invalid UUID"
|
"Invalid UUID"
|
||||||
)
|
)
|
||||||
return function(request, *args, **kwargs)
|
return function(request, *args, **kwargs)
|
||||||
|
|||||||
55
konova/filters/mixins/user_log.py
Normal file
55
konova/filters/mixins/user_log.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||||
|
Contact: ksp-servicestelle@sgdnord.rlp.de
|
||||||
|
Created on: 19.08.24
|
||||||
|
|
||||||
|
"""
|
||||||
|
import django_filters
|
||||||
|
from django import forms
|
||||||
|
from django.db.models import QuerySet, Q
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
|
class UserLoggedTableFilterMixin(django_filters.FilterSet):
|
||||||
|
ul = django_filters.CharFilter(
|
||||||
|
method="filter_user_log",
|
||||||
|
label=_(""),
|
||||||
|
label_suffix=_(""),
|
||||||
|
widget=forms.TextInput(
|
||||||
|
attrs={
|
||||||
|
"placeholder": _("Logged user"),
|
||||||
|
"title": _("Search for entries where this person has been participated according to log history"),
|
||||||
|
"class": "form-control",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
def filter_user_log(self, queryset, name, value) -> QuerySet:
|
||||||
|
""" Filters queryset depending on value of input
|
||||||
|
|
||||||
|
Args:
|
||||||
|
queryset (QuerySet): Incoming (prefiltered) queryset
|
||||||
|
name (str): Name of input field
|
||||||
|
value (str): Value of input field
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
value = value.replace(",", " ")
|
||||||
|
value = value.strip()
|
||||||
|
values = value.split(" ")
|
||||||
|
|
||||||
|
q = Q()
|
||||||
|
for val in values:
|
||||||
|
q &= (
|
||||||
|
Q(log__user__username__icontains=val) |
|
||||||
|
Q(log__user__first_name__icontains=val) |
|
||||||
|
Q(log__user__last_name__icontains=val)
|
||||||
|
)
|
||||||
|
|
||||||
|
queryset = queryset.filter(q)
|
||||||
|
return queryset
|
||||||
@@ -14,6 +14,7 @@ from konova.filters.mixins.office import ConservationOfficeTableFilterMixin, Reg
|
|||||||
from konova.filters.mixins.record import RecordableTableFilterMixin
|
from konova.filters.mixins.record import RecordableTableFilterMixin
|
||||||
from konova.filters.mixins.self_created import SelfCreatedTableFilterMixin
|
from konova.filters.mixins.self_created import SelfCreatedTableFilterMixin
|
||||||
from konova.filters.mixins.share import ShareableTableFilterMixin
|
from konova.filters.mixins.share import ShareableTableFilterMixin
|
||||||
|
from konova.filters.mixins.user_log import UserLoggedTableFilterMixin
|
||||||
|
|
||||||
|
|
||||||
class AbstractTableFilter(django_filters.FilterSet):
|
class AbstractTableFilter(django_filters.FilterSet):
|
||||||
@@ -40,7 +41,8 @@ class SelectionTableFilter(RegistrationOfficeTableFilterMixin,
|
|||||||
|
|
||||||
class QueryTableFilter(KeywordTableFilterMixin,
|
class QueryTableFilter(KeywordTableFilterMixin,
|
||||||
FileNumberTableFilterMixin,
|
FileNumberTableFilterMixin,
|
||||||
GeoReferencedTableFilterMixin):
|
GeoReferencedTableFilterMixin,
|
||||||
|
UserLoggedTableFilterMixin):
|
||||||
""" TableFilter holding different filter options for query related filtering
|
""" TableFilter holding different filter options for query related filtering
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class BaseForm(forms.Form):
|
|||||||
cancel_redirect = None
|
cancel_redirect = None
|
||||||
form_caption = None
|
form_caption = None
|
||||||
instance = None # The data holding model object
|
instance = None # The data holding model object
|
||||||
|
user = None # The performing user
|
||||||
request = None
|
request = None
|
||||||
form_attrs = {} # Holds additional attributes, that can be used in the template
|
form_attrs = {} # Holds additional attributes, that can be used in the template
|
||||||
has_required_fields = False # Automatically set. Triggers hint rendering in templates
|
has_required_fields = False # Automatically set. Triggers hint rendering in templates
|
||||||
@@ -33,6 +34,7 @@ class BaseForm(forms.Form):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.instance = kwargs.pop("instance", None)
|
self.instance = kwargs.pop("instance", None)
|
||||||
|
self.user = kwargs.pop("user", None)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
if self.request is not None:
|
if self.request is not None:
|
||||||
self.user = self.request.user
|
self.user = self.request.user
|
||||||
@@ -46,7 +48,7 @@ class BaseForm(forms.Form):
|
|||||||
self.__check_valid_label_input_ratio()
|
self.__check_valid_label_input_ratio()
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def save(self):
|
def save(self, *arg, **kwargs):
|
||||||
# To be implemented in subclasses!
|
# To be implemented in subclasses!
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -25,15 +25,16 @@ class SimpleGeomForm(BaseForm):
|
|||||||
""" A geometry form for rendering geometry read-only using a widget
|
""" A geometry form for rendering geometry read-only using a widget
|
||||||
|
|
||||||
"""
|
"""
|
||||||
read_only = True
|
read_only: bool = True
|
||||||
geometry_simplified = False
|
_geometry_simplified: bool = False
|
||||||
geom = JSONField(
|
output = JSONField(
|
||||||
label=_("Geometry"),
|
label=_("Geometry"),
|
||||||
help_text=_(""),
|
help_text=_(""),
|
||||||
label_suffix="",
|
label_suffix="",
|
||||||
required=False,
|
required=False,
|
||||||
disabled=False,
|
disabled=False,
|
||||||
)
|
)
|
||||||
|
_num_geometries_ignored: int = 0
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.read_only = kwargs.pop("read_only", True)
|
self.read_only = kwargs.pop("read_only", True)
|
||||||
@@ -48,33 +49,33 @@ class SimpleGeomForm(BaseForm):
|
|||||||
raise AttributeError
|
raise AttributeError
|
||||||
|
|
||||||
geojson = self.instance.geometry.as_feature_collection(srid=DEFAULT_SRID_RLP)
|
geojson = self.instance.geometry.as_feature_collection(srid=DEFAULT_SRID_RLP)
|
||||||
|
self._set_geojson_properties(geojson, title=self.instance.identifier or None)
|
||||||
geom = json.dumps(geojson)
|
geom = json.dumps(geojson)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# If no geometry exists for this form, we simply set the value to None and zoom to the maximum level
|
# If no geometry exists for this form, we simply set the value to None and zoom to the maximum level
|
||||||
geom = ""
|
geom = ""
|
||||||
self.empty = True
|
self.empty = True
|
||||||
|
|
||||||
self.initialize_form_field("geom", geom)
|
self.initialize_form_field("output", geom)
|
||||||
|
|
||||||
def is_valid(self):
|
def is_valid(self):
|
||||||
super().is_valid()
|
super().is_valid()
|
||||||
is_valid = True
|
is_valid = True
|
||||||
|
|
||||||
# Get geojson from form
|
# Get geojson from form
|
||||||
geom = self.data["geom"]
|
geom = self.data.get("output", None)
|
||||||
if geom is None or len(geom) == 0:
|
if geom is None or len(geom) == 0:
|
||||||
# empty geometry is a valid geometry
|
# empty geometry is a valid geometry
|
||||||
self.cleaned_data["geom"] = MultiPolygon(srid=DEFAULT_SRID_RLP).ewkt
|
self.cleaned_data["output"] = MultiPolygon(srid=DEFAULT_SRID_RLP).ewkt
|
||||||
return is_valid
|
return is_valid
|
||||||
geom = json.loads(geom)
|
geom = json.loads(geom)
|
||||||
|
|
||||||
# Write submitted data back into form field to make sure invalid geometry
|
# Write submitted data back into form field to make sure invalid geometry
|
||||||
# will be rendered again on failed submit
|
# will be rendered again on failed submit
|
||||||
self.initialize_form_field("geom", self.data["geom"])
|
self.initialize_form_field("output", self.data["output"])
|
||||||
|
|
||||||
# Read geojson into gdal geometry
|
# Initialize features list with empty MultiPolygon, so that an empty input will result in a
|
||||||
# HINT: This can be simplified if the geojson format holds data in epsg:4326 (GDAL provides direct creation for
|
# proper empty MultiPolygon object
|
||||||
# this case)
|
|
||||||
features = []
|
features = []
|
||||||
features_json = geom.get("features", [])
|
features_json = geom.get("features", [])
|
||||||
accepted_ogr_types = [
|
accepted_ogr_types = [
|
||||||
@@ -97,33 +98,41 @@ class SimpleGeomForm(BaseForm):
|
|||||||
g = self.__flatten_geom_to_2D(g)
|
g = self.__flatten_geom_to_2D(g)
|
||||||
|
|
||||||
if g.geom_type not in accepted_ogr_types:
|
if g.geom_type not in accepted_ogr_types:
|
||||||
self.add_error("geom", _("Only surfaces allowed. Points or lines must be buffered."))
|
self.add_error("output", _("Only surfaces allowed. Points or lines must be buffered."))
|
||||||
is_valid &= False
|
is_valid &= False
|
||||||
return is_valid
|
return is_valid
|
||||||
|
|
||||||
is_valid &= self.__is_area_valid(g)
|
is_area_valid = self.__is_area_valid(g)
|
||||||
|
if not is_area_valid:
|
||||||
|
# Geometries with an invalid size will not be saved to the db
|
||||||
|
# We assume these are malicious snippets which are not supposed to be in the geometry in the first place
|
||||||
|
self._num_geometries_ignored += 1
|
||||||
|
continue
|
||||||
|
|
||||||
polygon = Polygon.from_ewkt(g.ewkt)
|
g = Polygon.from_ewkt(g.ewkt)
|
||||||
is_valid &= polygon.valid
|
is_valid &= g.valid
|
||||||
if not polygon.valid:
|
if not g.valid:
|
||||||
self.add_error("geom", polygon.valid_reason)
|
self.add_error("output", g.valid_reason)
|
||||||
return is_valid
|
return is_valid
|
||||||
|
|
||||||
features.append(polygon)
|
if isinstance(g, Polygon):
|
||||||
|
features.append(g)
|
||||||
|
elif isinstance(g, MultiPolygon):
|
||||||
|
features.extend(list(g))
|
||||||
|
|
||||||
# Unionize all geometry features into one new MultiPolygon
|
# Unionize all geometry features into one new MultiPolygon
|
||||||
form_geom = MultiPolygon(srid=DEFAULT_SRID_RLP)
|
if features:
|
||||||
for feature in features:
|
form_geom = MultiPolygon(*features, srid=DEFAULT_SRID_RLP).unary_union
|
||||||
form_geom = form_geom.union(feature)
|
else:
|
||||||
|
form_geom = MultiPolygon(srid=DEFAULT_SRID_RLP)
|
||||||
|
|
||||||
# Make sure to convert into a MultiPolygon. Relevant if a single Polygon is provided.
|
# Make sure to convert into a MultiPolygon. Relevant if a single Polygon is provided.
|
||||||
if form_geom.geom_type != "MultiPolygon":
|
form_geom = Geometry.cast_to_multipolygon(form_geom)
|
||||||
form_geom = MultiPolygon(form_geom, srid=DEFAULT_SRID_RLP)
|
|
||||||
|
|
||||||
# Write unioned Multipolygon into cleaned data
|
# Write unioned Multipolygon into cleaned data
|
||||||
if self.cleaned_data is None:
|
if self.cleaned_data is None:
|
||||||
self.cleaned_data = {}
|
self.cleaned_data = {}
|
||||||
self.cleaned_data["geom"] = form_geom.ewkt
|
self.cleaned_data["output"] = form_geom.ewkt
|
||||||
|
|
||||||
return is_valid
|
return is_valid
|
||||||
|
|
||||||
@@ -133,7 +142,7 @@ class SimpleGeomForm(BaseForm):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
geom = self.cleaned_data.get("geom")
|
geom = self.cleaned_data.get("output")
|
||||||
g = gdal.OGRGeometry(geom, srs=DEFAULT_SRID_RLP)
|
g = gdal.OGRGeometry(geom, srs=DEFAULT_SRID_RLP)
|
||||||
num_vertices = g.num_coords
|
num_vertices = g.num_coords
|
||||||
|
|
||||||
@@ -146,15 +155,6 @@ class SimpleGeomForm(BaseForm):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
is_area_valid = geom.area > 1 # > 1m² (SRID:25832)
|
is_area_valid = geom.area > 1 # > 1m² (SRID:25832)
|
||||||
|
|
||||||
if not is_area_valid:
|
|
||||||
self.add_error(
|
|
||||||
"geom",
|
|
||||||
_("Geometry must be greater than 1m². Currently is {}m²").format(
|
|
||||||
float(geom.area)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return is_area_valid
|
return is_area_valid
|
||||||
|
|
||||||
def __simplify_geometry(self, geom, max_vert: int):
|
def __simplify_geometry(self, geom, max_vert: int):
|
||||||
@@ -192,14 +192,14 @@ class SimpleGeomForm(BaseForm):
|
|||||||
if self.instance is None or self.instance.geometry is None:
|
if self.instance is None or self.instance.geometry is None:
|
||||||
raise LookupError
|
raise LookupError
|
||||||
geometry = self.instance.geometry
|
geometry = self.instance.geometry
|
||||||
geometry.geom = self.cleaned_data.get("geom", MultiPolygon(srid=DEFAULT_SRID_RLP))
|
geometry.geom = self.cleaned_data.get("output", MultiPolygon(srid=DEFAULT_SRID_RLP))
|
||||||
geometry.modified = action
|
geometry.modified = action
|
||||||
|
|
||||||
geometry.save()
|
geometry.save()
|
||||||
except LookupError:
|
except LookupError:
|
||||||
# No geometry or linked instance holding a geometry exist --> create a new one!
|
# No geometry or linked instance holding a geometry exist --> create a new one!
|
||||||
geometry = Geometry.objects.create(
|
geometry = Geometry.objects.create(
|
||||||
geom=self.cleaned_data.get("geom", MultiPolygon(srid=DEFAULT_SRID_RLP)),
|
geom=self.cleaned_data.get("output", MultiPolygon(srid=DEFAULT_SRID_RLP)),
|
||||||
created=action,
|
created=action,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -207,13 +207,29 @@ class SimpleGeomForm(BaseForm):
|
|||||||
if not is_vertices_num_valid:
|
if not is_vertices_num_valid:
|
||||||
geometry.geom = self.__simplify_geometry(geometry.geom, max_vert=GEOM_MAX_VERTICES)
|
geometry.geom = self.__simplify_geometry(geometry.geom, max_vert=GEOM_MAX_VERTICES)
|
||||||
geometry.save()
|
geometry.save()
|
||||||
self.geometry_simplified = True
|
self._geometry_simplified = True
|
||||||
|
|
||||||
# Start parcel update and geometry conflict checking procedure in a background process
|
# Start parcel update and geometry conflict checking procedure in a background process
|
||||||
celery_update_parcels.delay(geometry.id)
|
celery_update_parcels.delay(geometry.id)
|
||||||
celery_check_for_geometry_conflicts.delay(geometry.id)
|
celery_check_for_geometry_conflicts.delay(geometry.id)
|
||||||
return geometry
|
return geometry
|
||||||
|
|
||||||
|
def get_num_geometries_ignored(self):
|
||||||
|
""" Returns the number of geometries which had to be ignored for various reasons
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self._num_geometries_ignored
|
||||||
|
|
||||||
|
def has_geometry_simplified(self):
|
||||||
|
""" Returns whether the geometry has been simplified or not.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self._geometry_simplified
|
||||||
|
|
||||||
def __flatten_geom_to_2D(self, geom):
|
def __flatten_geom_to_2D(self, geom):
|
||||||
"""
|
"""
|
||||||
Enforces a given OGRGeometry from higher dimensions into 2D
|
Enforces a given OGRGeometry from higher dimensions into 2D
|
||||||
@@ -223,3 +239,20 @@ class SimpleGeomForm(BaseForm):
|
|||||||
g_wkt = wkt_w.write(geom.geos).decode("utf-8")
|
g_wkt = wkt_w.write(geom.geos).decode("utf-8")
|
||||||
geom = gdal.OGRGeometry(g_wkt)
|
geom = gdal.OGRGeometry(g_wkt)
|
||||||
return geom
|
return geom
|
||||||
|
|
||||||
|
def _set_geojson_properties(self, geojson: dict, title: str = None):
|
||||||
|
""" Toggles the editable property of the geojson for proper handling in map client
|
||||||
|
|
||||||
|
Args:
|
||||||
|
geojson (dict): The GeoJson
|
||||||
|
title (str): An alternative title for the geometry
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
geojson (dict): The altered GeoJson
|
||||||
|
"""
|
||||||
|
features = geojson.get("features", [])
|
||||||
|
for feature in features:
|
||||||
|
feature["properties"]["editable"] = not self.read_only
|
||||||
|
if title:
|
||||||
|
feature["properties"]["title"] = title
|
||||||
|
return geojson
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ Created on: 26.10.22
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
import zipfile
|
import zipfile
|
||||||
|
from datetime import datetime
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from django.core.mail import EmailMessage
|
from django.core.mail import EmailMessage
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.datetime_safe import datetime
|
|
||||||
|
|
||||||
from analysis.utils.excel.excel import TempExcelFile
|
from analysis.utils.excel.excel import TempExcelFile
|
||||||
from analysis.utils.report import TimespanReport
|
from analysis.utils.report import TimespanReport
|
||||||
|
|||||||
88
konova/management/commands/recalculate_parcels.py
Normal file
88
konova/management/commands/recalculate_parcels.py
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||||
|
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||||
|
Created on: 04.01.22
|
||||||
|
|
||||||
|
"""
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from django.contrib.gis.db.models.functions import Area
|
||||||
|
|
||||||
|
from konova.management.commands.setup import BaseKonovaCommand
|
||||||
|
from konova.models import Geometry, ParcelIntersection
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseKonovaCommand):
|
||||||
|
help = "Recalculates parcels for entries with geometry but missing parcel information"
|
||||||
|
|
||||||
|
def add_arguments(self, parser):
|
||||||
|
parser.add_argument(
|
||||||
|
"--force-all",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="If Attribute set, all entries parcels will be recalculated"
|
||||||
|
)
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
try:
|
||||||
|
self.recalculate_parcels(options)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
self._break_line()
|
||||||
|
exit(-1)
|
||||||
|
|
||||||
|
def recalculate_parcels(self, options: dict):
|
||||||
|
force_all = options.get("force_all", False)
|
||||||
|
|
||||||
|
geometry_objects = Geometry.objects.filter(
|
||||||
|
geom__isempty=False,
|
||||||
|
).exclude(
|
||||||
|
geom=None
|
||||||
|
)
|
||||||
|
|
||||||
|
if not force_all:
|
||||||
|
# Fetch all intersections
|
||||||
|
intersection_objs = ParcelIntersection.objects.filter(
|
||||||
|
geometry__in=geometry_objects
|
||||||
|
)
|
||||||
|
# Just take the geometry ids, which seem to have intersections
|
||||||
|
geom_with_intersection_ids = intersection_objs.values_list(
|
||||||
|
"geometry__id",
|
||||||
|
flat=True
|
||||||
|
)
|
||||||
|
# ... and resolve into Geometry objects again ...
|
||||||
|
intersected_geom_objs = Geometry.objects.filter(
|
||||||
|
id__in=geom_with_intersection_ids
|
||||||
|
)
|
||||||
|
# ... to be able to use the way more efficient difference() function ...
|
||||||
|
geometry_objects_ids = geometry_objects.difference(intersected_geom_objs).values_list("id", flat=True)
|
||||||
|
# ... so we can resolve these into proper Geometry objects again for further annotation usage
|
||||||
|
geometry_objects = Geometry.objects.filter(id__in=geometry_objects_ids)
|
||||||
|
|
||||||
|
self._write_warning("=== Update parcels and districts ===")
|
||||||
|
# Order geometries by size to process smaller once at first
|
||||||
|
geometries = geometry_objects.annotate(
|
||||||
|
area=Area("geom")
|
||||||
|
).order_by(
|
||||||
|
'area'
|
||||||
|
)
|
||||||
|
self._write_warning(f"Process parcels for {geometries.count()} geometry entries now ...")
|
||||||
|
i = 0
|
||||||
|
num_geoms = geometries.count()
|
||||||
|
geoms_with_errors = {}
|
||||||
|
for geometry in geometries:
|
||||||
|
self._write_warning(f"--- {datetime.datetime.now()} Process {geometry.id} now ...")
|
||||||
|
try:
|
||||||
|
geometry.update_parcels()
|
||||||
|
self._write_warning(f"--- Processed {geometry.get_underlying_parcels().count()} underlying parcels")
|
||||||
|
except Exception as e:
|
||||||
|
geoms_with_errors[geometry.id] = str(e)
|
||||||
|
i += 1
|
||||||
|
self._write_warning(f"--- {i}/{num_geoms} processed")
|
||||||
|
|
||||||
|
self._write_success("Updating parcels done!")
|
||||||
|
|
||||||
|
for key, val in geoms_with_errors.items():
|
||||||
|
self._write_error(f" Error on {key}: {val}")
|
||||||
|
self._write_success(f"{num_geoms - len(geoms_with_errors)} geometries successfuly recalculated!")
|
||||||
|
self._break_line()
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
"""
|
|
||||||
Author: Michel Peltriaux
|
|
||||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
|
||||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
|
||||||
Created on: 19.08.21
|
|
||||||
|
|
||||||
"""
|
|
||||||
from django.core.management import BaseCommand
|
|
||||||
|
|
||||||
from intervention.models import Intervention
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
|
||||||
help = "Performs test on collisions using the identifier generation"
|
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
|
||||||
identifiers = {}
|
|
||||||
max_iterations = 100000
|
|
||||||
try:
|
|
||||||
collisions = 0
|
|
||||||
len_ids = len(identifiers)
|
|
||||||
while len_ids < max_iterations:
|
|
||||||
tmp_intervention = Intervention()
|
|
||||||
_id = tmp_intervention.generate_new_identifier()
|
|
||||||
len_ids = len(identifiers)
|
|
||||||
if _id not in identifiers:
|
|
||||||
if len_ids % (max_iterations/5) == 0:
|
|
||||||
print(len_ids)
|
|
||||||
identifiers[_id] = None
|
|
||||||
else:
|
|
||||||
collisions += 1
|
|
||||||
print("+++ Collision after {} identifiers +++".format(len_ids))
|
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
self._break_line()
|
|
||||||
exit(-1)
|
|
||||||
print(
|
|
||||||
"\n{} collisions in {} identifiers; Collision rate {}%".format(
|
|
||||||
collisions,
|
|
||||||
len_ids,
|
|
||||||
(collisions / len_ids)*100,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
def _break_line(self):
|
|
||||||
""" Simply prints a line break
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
"""
|
|
||||||
self.stdout.write("\n")
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
"""
|
|
||||||
Author: Michel Peltriaux
|
|
||||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
|
||||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
|
||||||
Created on: 04.01.22
|
|
||||||
|
|
||||||
"""
|
|
||||||
import datetime
|
|
||||||
|
|
||||||
from django.contrib.gis.db.models.functions import Area
|
|
||||||
|
|
||||||
from konova.management.commands.setup import BaseKonovaCommand
|
|
||||||
from konova.models import Geometry, Parcel, District
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseKonovaCommand):
|
|
||||||
help = "Checks the database' sanity and removes unused entries"
|
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
|
||||||
try:
|
|
||||||
self.update_all_parcels()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
self._break_line()
|
|
||||||
exit(-1)
|
|
||||||
|
|
||||||
def update_all_parcels(self):
|
|
||||||
num_parcels_before = Parcel.objects.count()
|
|
||||||
num_districts_before = District.objects.count()
|
|
||||||
self._write_warning("=== Update parcels and districts ===")
|
|
||||||
# Order geometries by size to process smaller once at first
|
|
||||||
geometries = Geometry.objects.all().exclude(
|
|
||||||
geom=None
|
|
||||||
).annotate(area=Area("geom")).order_by(
|
|
||||||
'area'
|
|
||||||
)
|
|
||||||
self._write_warning(f"Process parcels for {geometries.count()} geometry entries now ...")
|
|
||||||
i = 0
|
|
||||||
num_geoms = geometries.count()
|
|
||||||
for geometry in geometries:
|
|
||||||
self._write_warning(f"--- {datetime.datetime.now()} Process {geometry.id} now ...")
|
|
||||||
geometry.update_parcels()
|
|
||||||
self._write_warning(f"--- Processed {geometry.get_underlying_parcels().count()} underlying parcels")
|
|
||||||
i += 1
|
|
||||||
self._write_warning(f"--- {i}/{num_geoms} processed")
|
|
||||||
|
|
||||||
num_parcels_after = Parcel.objects.count()
|
|
||||||
num_districts_after = District.objects.count()
|
|
||||||
if num_parcels_after != num_parcels_before:
|
|
||||||
self._write_error(f"Parcels have changed: {num_parcels_before} to {num_parcels_after} entries. You should run the sanitize command.")
|
|
||||||
if num_districts_after != num_districts_before:
|
|
||||||
self._write_error(f"Districts have changed: {num_districts_before} to {num_districts_after} entries. You should run the sanitize command.")
|
|
||||||
|
|
||||||
self._write_success("Updating parcels done!")
|
|
||||||
self._break_line()
|
|
||||||
@@ -8,9 +8,10 @@ Created on: 15.11.21
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from django.contrib.gis.db.models import MultiPolygonField
|
from django.contrib.gis.db.models import MultiPolygonField
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.contrib.gis.geos import MultiPolygon
|
||||||
|
|
||||||
from konova.models import BaseResource, UuidModel
|
from konova.models import BaseResource, UuidModel
|
||||||
from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP
|
from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP
|
||||||
@@ -223,6 +224,17 @@ class Geometry(BaseResource):
|
|||||||
)
|
)
|
||||||
parcel_obj.updated_on = _now
|
parcel_obj.updated_on = _now
|
||||||
parcels_to_update.append(parcel_obj)
|
parcels_to_update.append(parcel_obj)
|
||||||
|
except MultipleObjectsReturned:
|
||||||
|
parcel_obj = Parcel.make_unique(
|
||||||
|
district=district,
|
||||||
|
municipal=municipal,
|
||||||
|
parcel_group=parcel_group,
|
||||||
|
flr=flr_val,
|
||||||
|
flrstck_nnr=flrstck_nnr,
|
||||||
|
flrstck_zhlr=flrstck_zhlr,
|
||||||
|
)
|
||||||
|
parcel_obj.updated_on = _now
|
||||||
|
parcels_to_update.append(parcel_obj)
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
# If not existing, create object but do not commit, yet
|
# If not existing, create object but do not commit, yet
|
||||||
parcel_obj = Parcel(
|
parcel_obj = Parcel(
|
||||||
@@ -331,6 +343,7 @@ class Geometry(BaseResource):
|
|||||||
{
|
{
|
||||||
"type": "Feature",
|
"type": "Feature",
|
||||||
"geometry": json.loads(p.json),
|
"geometry": json.loads(p.json),
|
||||||
|
"properties": {},
|
||||||
}
|
}
|
||||||
for p in polygons
|
for p in polygons
|
||||||
]
|
]
|
||||||
@@ -366,13 +379,42 @@ class Geometry(BaseResource):
|
|||||||
diff = geom_envelope - self.geom
|
diff = geom_envelope - self.geom
|
||||||
|
|
||||||
if diff.area == 0:
|
if diff.area == 0:
|
||||||
ratio = 1
|
complexity_factor = 1
|
||||||
else:
|
else:
|
||||||
ratio = self.geom.area / diff.area
|
complexity_factor = self.geom.area / diff.area
|
||||||
|
|
||||||
complexity_factor = 1 - ratio
|
|
||||||
return complexity_factor
|
return complexity_factor
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def cast_to_multipolygon(input_geom):
|
||||||
|
""" If input_geom is not a MultiPolygon, cast to MultiPolygon
|
||||||
|
|
||||||
|
Args:
|
||||||
|
input_geom ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
output_geom
|
||||||
|
"""
|
||||||
|
output_geom = input_geom
|
||||||
|
if not isinstance(input_geom, MultiPolygon):
|
||||||
|
output_geom = MultiPolygon(input_geom, srid=DEFAULT_SRID_RLP)
|
||||||
|
return output_geom
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def cast_to_rlp_srid(input_geom):
|
||||||
|
""" If input_geom is not of RLP SRID (25832), cast to RLP SRID
|
||||||
|
|
||||||
|
Args:
|
||||||
|
input_geom ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
output_geom
|
||||||
|
"""
|
||||||
|
output_geom = input_geom
|
||||||
|
if output_geom.srid != DEFAULT_SRID_RLP:
|
||||||
|
output_geom.transform(DEFAULT_SRID_RLP)
|
||||||
|
return output_geom
|
||||||
|
|
||||||
|
|
||||||
class GeometryConflict(UuidModel):
|
class GeometryConflict(UuidModel):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Contact: michel.peltriaux@sgdnord.rlp.de
|
|||||||
Created on: 16.12.21
|
Created on: 16.12.21
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.db import models
|
from django.db import models, transaction
|
||||||
|
|
||||||
from konova.models import UuidModel
|
from konova.models import UuidModel
|
||||||
|
|
||||||
@@ -158,6 +158,46 @@ class Parcel(UuidModel):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.parcel_group} | {self.flr} | {self.flrstck_zhlr} | {self.flrstck_nnr}"
|
return f"{self.parcel_group} | {self.flr} | {self.flrstck_zhlr} | {self.flrstck_nnr}"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def make_unique(cls, **kwargs):
|
||||||
|
""" Checks for duplicates of a Parcel, choose a (now) unique one,
|
||||||
|
repairs relations for ParcelIntersection and removes duplicates.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
**kwargs ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
unique_true (Parcel): The new unique 'true one'
|
||||||
|
"""
|
||||||
|
parcel_objs = Parcel.objects.filter(**kwargs)
|
||||||
|
|
||||||
|
if not parcel_objs.exists():
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Get one of the found parcels and use it as new 'true one'
|
||||||
|
unique_parcel = parcel_objs.first()
|
||||||
|
# separate it from the rest
|
||||||
|
parcel_objs = parcel_objs.exclude(id=unique_parcel.id)
|
||||||
|
|
||||||
|
if not parcel_objs.exists():
|
||||||
|
# There are no duplicates - all good, just return
|
||||||
|
return unique_parcel
|
||||||
|
|
||||||
|
# Fetch existing intersections, which still point on the duplicated parcels
|
||||||
|
intersection_objs = ParcelIntersection.objects.filter(
|
||||||
|
parcel__in=parcel_objs
|
||||||
|
)
|
||||||
|
|
||||||
|
# Change each intersection, so they point on the 'true one' parcel from now on
|
||||||
|
for intersection in intersection_objs:
|
||||||
|
intersection.parcel = unique_parcel
|
||||||
|
intersection.save()
|
||||||
|
|
||||||
|
# Remove the duplicated parcels
|
||||||
|
parcel_objs.delete()
|
||||||
|
|
||||||
|
return unique_parcel
|
||||||
|
|
||||||
|
|
||||||
class ParcelIntersection(UuidModel):
|
class ParcelIntersection(UuidModel):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -279,3 +279,17 @@ Similar to bootstraps 'shadow-lg'
|
|||||||
.alert{
|
.alert{
|
||||||
margin-bottom: 0 !important;
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Overwrites netgis.css attributes
|
||||||
|
*/
|
||||||
|
.netgis-gradient-a{
|
||||||
|
/*
|
||||||
|
Overwrites gradient used on default css of netgis map client
|
||||||
|
*/
|
||||||
|
background: var(--rlp-red) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal{
|
||||||
|
z-index: 100000;
|
||||||
|
}
|
||||||
BIN
konova/static/images/error_imgs/croc_technician_400.png
Normal file
BIN
konova/static/images/error_imgs/croc_technician_400.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
BIN
konova/static/images/error_imgs/croc_technician_500.png
Normal file
BIN
konova/static/images/error_imgs/croc_technician_500.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
@@ -66,7 +66,6 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'django.contrib.gis',
|
'django.contrib.gis',
|
||||||
'django.contrib.humanize',
|
'django.contrib.humanize',
|
||||||
'simple_sso.sso_server',
|
|
||||||
'django_tables2',
|
'django_tables2',
|
||||||
'bootstrap_modal_forms',
|
'bootstrap_modal_forms',
|
||||||
'fontawesome_5',
|
'fontawesome_5',
|
||||||
@@ -189,7 +188,6 @@ STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
|||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = [
|
||||||
os.path.join(BASE_DIR, 'konova/static'),
|
os.path.join(BASE_DIR, 'konova/static'),
|
||||||
os.path.join(BASE_DIR, 'templates/map/client'), # NETGIS map client files
|
os.path.join(BASE_DIR, 'templates/map/client'), # NETGIS map client files
|
||||||
os.path.join(BASE_DIR, 'templates/map/client/libs'), # NETGIS map client files
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# EMAIL (see https://docs.djangoproject.com/en/dev/topics/email/)
|
# EMAIL (see https://docs.djangoproject.com/en/dev/topics/email/)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Contact: michel.peltriaux@sgdnord.rlp.de
|
|||||||
Created on: 31.01.22
|
Created on: 31.01.22
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from konova.sub_settings.django_settings import env
|
||||||
|
|
||||||
# MAPS
|
# MAPS
|
||||||
DEFAULT_LAT = 50.00
|
DEFAULT_LAT = 50.00
|
||||||
@@ -28,3 +29,6 @@ LANIS_ZOOM_LUT = {
|
|||||||
1000: 30,
|
1000: 30,
|
||||||
500: 31,
|
500: 31,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MAP_PROXY_HOST_WHITELIST = env.list("MAP_PROXY_HOST_WHITELIST")
|
||||||
|
i = 0
|
||||||
@@ -16,3 +16,5 @@ OAUTH_CODE_VERIFIER = env("OAUTH_CODE_VERIFIER")
|
|||||||
|
|
||||||
OAUTH_CLIENT_ID = env("OAUTH_CLIENT_ID")
|
OAUTH_CLIENT_ID = env("OAUTH_CLIENT_ID")
|
||||||
OAUTH_CLIENT_SECRET = env("OAUTH_CLIENT_SECRET")
|
OAUTH_CLIENT_SECRET = env("OAUTH_CLIENT_SECRET")
|
||||||
|
|
||||||
|
PROPAGATION_SECRET = env("PROPAGATION_SECRET")
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ class GeometryTestCase(BaseTestCase):
|
|||||||
{
|
{
|
||||||
"type": "Feature",
|
"type": "Feature",
|
||||||
"geometry": json.loads(p.json),
|
"geometry": json.loads(p.json),
|
||||||
|
"properties": {}
|
||||||
}
|
}
|
||||||
for p in polygons
|
for p in polygons
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ class BaseTestCase(TestCase):
|
|||||||
eco_account.save()
|
eco_account.save()
|
||||||
return eco_account
|
return eco_account
|
||||||
|
|
||||||
def assert_equal_geometries(self, geom1: MultiPolygon, geom2: MultiPolygon, tolerance = 0.001):
|
def assert_equal_geometries(self, geom1: MultiPolygon, geom2: MultiPolygon, tolerance=0.001):
|
||||||
""" Assert for geometries to be equal
|
""" Assert for geometries to be equal
|
||||||
|
|
||||||
Transforms the geometries to matching srids before checking
|
Transforms the geometries to matching srids before checking
|
||||||
@@ -491,7 +491,10 @@ class BaseTestCase(TestCase):
|
|||||||
# transformation from one coordinate system into the other, which is valid
|
# transformation from one coordinate system into the other, which is valid
|
||||||
geom1.transform(geom2.srid)
|
geom1.transform(geom2.srid)
|
||||||
geom2.transform(geom1.srid)
|
geom2.transform(geom1.srid)
|
||||||
self.assertTrue(geom1.equals_exact(geom2, tolerance) or geom2.equals_exact(geom1, tolerance))
|
self.assertTrue(
|
||||||
|
geom1.equals_exact(geom2, tolerance=tolerance),
|
||||||
|
msg=f"Difference is {abs(geom1.area - geom2.area)} with {geom1.area} and {geom2.area} in a tolerance of {tolerance}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BaseViewTestCase(BaseTestCase):
|
class BaseViewTestCase(BaseTestCase):
|
||||||
|
|||||||
@@ -42,5 +42,6 @@ urlpatterns = [
|
|||||||
path('client/proxy/wfs', ClientProxyParcelWFS.as_view(), name="client-proxy-wfs"),
|
path('client/proxy/wfs', ClientProxyParcelWFS.as_view(), name="client-proxy-wfs"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
handler400 = "konova.views.error.get_400_view"
|
||||||
handler404 = "konova.views.error.get_404_view"
|
handler404 = "konova.views.error.get_404_view"
|
||||||
handler500 = "konova.views.error.get_500_view"
|
handler500 = "konova.views.error.get_500_view"
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ Contact: michel.peltriaux@sgdnord.rlp.de
|
|||||||
Created on: 17.09.21
|
Created on: 17.09.21
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from uuid import UUID
|
||||||
|
|
||||||
|
from django.contrib import messages
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
from django.http import HttpRequest, Http404
|
||||||
|
|
||||||
|
|
||||||
def format_german_float(num) -> str:
|
def format_german_float(num) -> str:
|
||||||
@@ -19,3 +24,28 @@ def format_german_float(num) -> str:
|
|||||||
num (str): The number as german Gleitkommazahl
|
num (str): The number as german Gleitkommazahl
|
||||||
"""
|
"""
|
||||||
return format(num, "0,.2f").replace(",", "X").replace(".", ",").replace("X", ".")
|
return format(num, "0,.2f").replace(",", "X").replace(".", ",").replace("X", ".")
|
||||||
|
|
||||||
|
|
||||||
|
def check_user_is_in_any_group(request: HttpRequest):
|
||||||
|
"""
|
||||||
|
Checks for any group membership. Adds a message in case of having none.
|
||||||
|
|
||||||
|
"""
|
||||||
|
user = request.user
|
||||||
|
# Inform user about missing group privileges!
|
||||||
|
groups = user.groups.all()
|
||||||
|
if not groups:
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
_("+++ Attention: You are not part of any group. You won't be able to create, edit or do anything. Please contact an administrator. +++")
|
||||||
|
)
|
||||||
|
return request
|
||||||
|
|
||||||
|
def check_id_is_valid_uuid(**kwargs: dict):
|
||||||
|
uuid = kwargs.get("uuid", None) or kwargs.get("id", None)
|
||||||
|
if uuid:
|
||||||
|
try:
|
||||||
|
# Check whether the id is a proper uuid or something that would break a db fetch
|
||||||
|
UUID(uuid)
|
||||||
|
except ValueError:
|
||||||
|
raise Http404
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ Created on: 09.11.20
|
|||||||
"""
|
"""
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import qrcode
|
|
||||||
import qrcode.image.svg
|
|
||||||
|
|
||||||
from io import BytesIO
|
|
||||||
|
|
||||||
|
|
||||||
def generate_token() -> str:
|
def generate_token() -> str:
|
||||||
@@ -42,23 +38,3 @@ def generate_random_string(length: int, use_numbers: bool = False, use_letters_l
|
|||||||
ret_val = "".join(random.choice(elements) for i in range(length))
|
ret_val = "".join(random.choice(elements) for i in range(length))
|
||||||
return ret_val
|
return ret_val
|
||||||
|
|
||||||
|
|
||||||
def generate_qr_code(content: str, size: int = 20) -> str:
|
|
||||||
""" Generates a qr code from given content
|
|
||||||
|
|
||||||
Args:
|
|
||||||
content (str): The content for the qr code
|
|
||||||
size (int): The image size
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
qrcode_svg (str): The qr code as svg
|
|
||||||
"""
|
|
||||||
qrcode_factory = qrcode.image.svg.SvgImage
|
|
||||||
qrcode_img = qrcode.make(
|
|
||||||
content,
|
|
||||||
image_factory=qrcode_factory,
|
|
||||||
box_size=size
|
|
||||||
)
|
|
||||||
stream = BytesIO()
|
|
||||||
qrcode_img.save(stream)
|
|
||||||
return stream.getvalue().decode()
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ EDITED_GENERAL_DATA = _("Edited general data")
|
|||||||
# Geometry
|
# Geometry
|
||||||
GEOMETRY_CONFLICT_WITH_TEMPLATE = _("Geometry conflict detected with {}")
|
GEOMETRY_CONFLICT_WITH_TEMPLATE = _("Geometry conflict detected with {}")
|
||||||
GEOMETRY_SIMPLIFIED = _("The geometry contained more than {} vertices. It had to be simplified to match the allowed limit of {} vertices.").format(GEOM_MAX_VERTICES, GEOM_MAX_VERTICES)
|
GEOMETRY_SIMPLIFIED = _("The geometry contained more than {} vertices. It had to be simplified to match the allowed limit of {} vertices.").format(GEOM_MAX_VERTICES, GEOM_MAX_VERTICES)
|
||||||
|
GEOMETRIES_IGNORED_TEMPLATE = _("The geometry contained {} parts which have been detected as invalid (e.g. too small to be valid). These parts have been removed. Please check the stored geometry.")
|
||||||
|
|
||||||
# INTERVENTION
|
# INTERVENTION
|
||||||
INTERVENTION_HAS_REVOCATIONS_TEMPLATE = _("This intervention has {} revocations")
|
INTERVENTION_HAS_REVOCATIONS_TEMPLATE = _("This intervention has {} revocations")
|
||||||
@@ -91,3 +92,6 @@ INTERVENTION_HAS_REVOCATIONS_TEMPLATE = _("This intervention has {} revocations"
|
|||||||
DATA_CHECKED_ON_TEMPLATE = _("Checked on {} by {}")
|
DATA_CHECKED_ON_TEMPLATE = _("Checked on {} by {}")
|
||||||
DATA_CHECKED_PREVIOUSLY_TEMPLATE = _("Data has changed since last check on {} by {}")
|
DATA_CHECKED_PREVIOUSLY_TEMPLATE = _("Data has changed since last check on {} by {}")
|
||||||
DATA_IS_UNCHECKED = _("Current data not checked yet")
|
DATA_IS_UNCHECKED = _("Current data not checked yet")
|
||||||
|
|
||||||
|
# API TOKEN SETTINGS
|
||||||
|
NEW_API_TOKEN_GENERATED = _("New token generated. Administrators need to validate.")
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
"""
|
|
||||||
Author: Michel Peltriaux
|
|
||||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
|
||||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
|
||||||
Created on: 17.08.21
|
|
||||||
|
|
||||||
"""
|
|
||||||
from collections import Iterable
|
|
||||||
|
|
||||||
import requests
|
|
||||||
from user.models import User
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
|
|
||||||
from konova.settings import SSO_SERVER_BASE, SSO_PUBLIC_KEY, PROXIES
|
|
||||||
from konova.sub_settings.context_settings import BASE_TITLE_SHORT
|
|
||||||
|
|
||||||
|
|
||||||
class Messenger:
|
|
||||||
""" Used to send messages to the SSO server.
|
|
||||||
|
|
||||||
Messages can be seen by the user the next time they login on their SSO dashboard.
|
|
||||||
Documentation for SSO Server-Client communication can be found here:
|
|
||||||
https://git.naturschutz.rlp.de/SGD-Nord/arnova/wiki/Messages
|
|
||||||
|
|
||||||
"""
|
|
||||||
server_url = "{}communication/message/".format(SSO_SERVER_BASE)
|
|
||||||
|
|
||||||
def __init__(self, users: Iterable, subject: str = None, body: str = None, type: str = None):
|
|
||||||
self.users = users
|
|
||||||
self.msg_subject = subject
|
|
||||||
self.msg_body = body
|
|
||||||
self.msg_type = type
|
|
||||||
|
|
||||||
def send(self):
|
|
||||||
""" Sends a message
|
|
||||||
|
|
||||||
"""
|
|
||||||
if self.msg_body is None or len(self.msg_body) == 0:
|
|
||||||
raise AttributeError("No message body set")
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
"x-services-public-key": SSO_PUBLIC_KEY
|
|
||||||
}
|
|
||||||
for user in self.users:
|
|
||||||
data = {
|
|
||||||
"type": self.msg_type,
|
|
||||||
"sender": BASE_TITLE_SHORT,
|
|
||||||
"receiver": user.username,
|
|
||||||
"subject": self.msg_subject,
|
|
||||||
"body": self.msg_body,
|
|
||||||
}
|
|
||||||
requests.post(
|
|
||||||
self.server_url,
|
|
||||||
data=data,
|
|
||||||
headers=headers,
|
|
||||||
proxies=PROXIES
|
|
||||||
)
|
|
||||||
|
|
||||||
def send_object_checked(self, obj_identifier: str, performing_user: User, detail_view_url: str = ""):
|
|
||||||
""" Wraps sending of a message related to the checking of an object, like an intervention
|
|
||||||
|
|
||||||
Args:
|
|
||||||
obj_identifier (str): The object's identifier (e.g. 'EIV-123'
|
|
||||||
performing_user (User): The user who performed the checking
|
|
||||||
detail_view_url (str): If a direct link to the object shall be added to the message, it can be provided here
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
"""
|
|
||||||
self.msg_subject = _("{} checked").format(obj_identifier)
|
|
||||||
if len(detail_view_url) > 0:
|
|
||||||
detail_view_url = _('<a href="{}">Check it out</a>').format(detail_view_url)
|
|
||||||
self.msg_body = _("{} has been checked successfully by user {}! {}").format(
|
|
||||||
obj_identifier,
|
|
||||||
performing_user.username,
|
|
||||||
detail_view_url
|
|
||||||
)
|
|
||||||
self.send()
|
|
||||||
47
konova/utils/qrcode.py
Normal file
47
konova/utils/qrcode.py
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Created on: 17.10.25
|
||||||
|
|
||||||
|
"""
|
||||||
|
from io import BytesIO
|
||||||
|
|
||||||
|
import qrcode
|
||||||
|
import qrcode.image.svg as svg
|
||||||
|
|
||||||
|
|
||||||
|
class QrCode:
|
||||||
|
""" A wrapping class for creating a qr code with content
|
||||||
|
|
||||||
|
"""
|
||||||
|
_content = None
|
||||||
|
_img = None
|
||||||
|
|
||||||
|
def __init__(self, content: str, size: int):
|
||||||
|
self._content = content
|
||||||
|
self._img = self._generate_qr_code(content, size)
|
||||||
|
|
||||||
|
def _generate_qr_code(self, content: str, size: int = 20) -> str:
|
||||||
|
""" Generates a qr code from given content
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content (str): The content for the qr code
|
||||||
|
size (int): The image size
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
qrcode_svg (str): The qr code as svg
|
||||||
|
"""
|
||||||
|
img_factory = svg.SvgImage
|
||||||
|
qrcode_img = qrcode.make(
|
||||||
|
content,
|
||||||
|
image_factory=img_factory,
|
||||||
|
box_size=size
|
||||||
|
)
|
||||||
|
stream = BytesIO()
|
||||||
|
qrcode_img.save(stream)
|
||||||
|
return stream.getvalue().decode()
|
||||||
|
|
||||||
|
def get_img(self):
|
||||||
|
return self._img
|
||||||
|
|
||||||
|
def get_content(self):
|
||||||
|
return self._content
|
||||||
@@ -11,6 +11,7 @@ from json import JSONDecodeError
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from konova.sub_settings import schneider_settings
|
from konova.sub_settings import schneider_settings
|
||||||
|
from konova.sub_settings.lanis_settings import DEFAULT_SRID
|
||||||
from konova.sub_settings.proxy_settings import PROXIES
|
from konova.sub_settings.proxy_settings import PROXIES
|
||||||
|
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ class ParcelFetcher:
|
|||||||
if geom.area < buffer_threshold:
|
if geom.area < buffer_threshold:
|
||||||
# Fallback for malicious geometries which are way too small and would disappear on negative buffering
|
# Fallback for malicious geometries which are way too small and would disappear on negative buffering
|
||||||
geom = geometry.geom
|
geom = geometry.geom
|
||||||
|
geom.transform(DEFAULT_SRID)
|
||||||
self.geojson = geom.ewkt
|
self.geojson = geom.ewkt
|
||||||
self.results = []
|
self.results = []
|
||||||
|
|
||||||
@@ -55,11 +57,11 @@ class ParcelFetcher:
|
|||||||
content = json.loads(response.content.decode("utf-8"))
|
content = json.loads(response.content.decode("utf-8"))
|
||||||
except JSONDecodeError:
|
except JSONDecodeError:
|
||||||
content = {}
|
content = {}
|
||||||
next = content.get("next", None)
|
_next = content.get("next", None)
|
||||||
fetched_parcels = content.get("results", [])
|
fetched_parcels = content.get("results", [])
|
||||||
self.results += fetched_parcels
|
self.results += fetched_parcels
|
||||||
|
|
||||||
if next:
|
if _next:
|
||||||
self.get_parcels(next)
|
self.get_parcels(_next)
|
||||||
|
|
||||||
return self.results
|
return self.results
|
||||||
@@ -216,11 +216,11 @@ class TableRenderMixin:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
html = ""
|
html = ""
|
||||||
has_access = record.is_shared_with(self.user)
|
is_entry_shared = record.is_shared_with(self.user)
|
||||||
|
|
||||||
html += self.render_icn(
|
html += self.render_icn(
|
||||||
tooltip=_("Full access granted") if has_access else _("Access not granted"),
|
tooltip=_("Full access granted") if is_entry_shared else _("Access not granted"),
|
||||||
icn_class="fas fa-edit rlp-r-inv" if has_access else "far fa-edit",
|
icn_class="fas fa-edit rlp-r-inv" if is_entry_shared else "far fa-edit",
|
||||||
)
|
)
|
||||||
return format_html(html)
|
return format_html(html)
|
||||||
|
|
||||||
|
|||||||
325
konova/views/base.py
Normal file
325
konova/views/base.py
Normal file
@@ -0,0 +1,325 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Created on: 15.10.25
|
||||||
|
|
||||||
|
"""
|
||||||
|
from abc import abstractmethod
|
||||||
|
|
||||||
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
|
from django.http import HttpRequest, JsonResponse
|
||||||
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
|
from django.urls import reverse
|
||||||
|
from django.views import View
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
from konova.contexts import BaseContext
|
||||||
|
from konova.forms import BaseForm, SimpleGeomForm
|
||||||
|
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||||
|
from konova.utils.general import check_user_is_in_any_group
|
||||||
|
from konova.utils.message_templates import MISSING_GROUP_PERMISSION, DATA_UNSHARED, IDENTIFIER_REPLACED, \
|
||||||
|
GEOMETRY_SIMPLIFIED, GEOMETRIES_IGNORED_TEMPLATE, RECORDED_BLOCKS_EDIT, CHECK_STATE_RESET, FORM_INVALID
|
||||||
|
|
||||||
|
|
||||||
|
class BaseView(View):
|
||||||
|
_TEMPLATE: str = "CHANGE_ME"
|
||||||
|
_TAB_TITLE: str = "CHANGE_ME"
|
||||||
|
_REDIRECT_URL: str = "CHANGE_ME"
|
||||||
|
_REDIRECT_URL_ERROR: str = "home"
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
def dispatch(self, request, *args, **kwargs):
|
||||||
|
request = check_user_is_in_any_group(request)
|
||||||
|
|
||||||
|
if not self._user_has_permission(request.user):
|
||||||
|
messages.info(request, MISSING_GROUP_PERMISSION)
|
||||||
|
return redirect(reverse(self._REDIRECT_URL_ERROR))
|
||||||
|
|
||||||
|
if not self._user_has_shared_access(request.user, **kwargs):
|
||||||
|
messages.info(request, DATA_UNSHARED)
|
||||||
|
return redirect(reverse(self._REDIRECT_URL_ERROR))
|
||||||
|
|
||||||
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
|
def _user_has_permission(self, user):
|
||||||
|
""" Has to be implemented properly by inheriting classes
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
return False
|
||||||
|
|
||||||
|
def _user_has_shared_access(self, user, **kwargs):
|
||||||
|
""" Has to be implemented properly by inheriting classes
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class BaseModalFormView(BaseView):
|
||||||
|
_TEMPLATE = "modal/modal_form.html"
|
||||||
|
_TAB_TITLE = None
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
|
||||||
|
class BaseIndexView(BaseView):
|
||||||
|
""" Base class for index views
|
||||||
|
|
||||||
|
"""
|
||||||
|
_TEMPLATE = "generic_index.html"
|
||||||
|
_INDEX_TABLE_CLS = None
|
||||||
|
_REDIRECT_URL = "home"
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
def get(self, request: HttpRequest):
|
||||||
|
qs = self._get_queryset()
|
||||||
|
table = self._INDEX_TABLE_CLS(
|
||||||
|
request=request,
|
||||||
|
queryset=qs
|
||||||
|
)
|
||||||
|
context = {
|
||||||
|
"table": table,
|
||||||
|
TAB_TITLE_IDENTIFIER: self._TAB_TITLE,
|
||||||
|
}
|
||||||
|
context = BaseContext(request, context).context
|
||||||
|
return render(request, self._TEMPLATE, context)
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def _get_queryset(self):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def _user_has_permission(self, user):
|
||||||
|
# No specific permissions needed for opening base index view
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _user_has_shared_access(self, user, **kwargs):
|
||||||
|
# No specific constraints for shared access of index views
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class BaseIdentifierGeneratorView(BaseView):
|
||||||
|
_MODEL_CLS = None
|
||||||
|
_REDIRECT_URL: str = "home"
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
def get(self, request: HttpRequest):
|
||||||
|
tmp_obj = self._MODEL_CLS()
|
||||||
|
identifier = tmp_obj.generate_new_identifier()
|
||||||
|
while self._MODEL_CLS.objects.filter(identifier=identifier).exists():
|
||||||
|
identifier = tmp_obj.generate_new_identifier()
|
||||||
|
return JsonResponse(
|
||||||
|
data={
|
||||||
|
"gen_data": identifier
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
def _user_has_permission(self, user):
|
||||||
|
""" Should be overwritten in inheriting classes!
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
return user.is_default_user()
|
||||||
|
|
||||||
|
def _user_has_shared_access(self, user, **kwargs):
|
||||||
|
# No specific constraints for shared access
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class BaseFormView(BaseView):
|
||||||
|
_MODEL_CLS = None
|
||||||
|
_FORM_CLS = None
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
def _get_additional_context(self, **kwargs):
|
||||||
|
"""
|
||||||
|
|
||||||
|
Args:
|
||||||
|
**kwargs ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
class BaseSpatialLocatedObjectFormView(LoginRequiredMixin, BaseFormView):
|
||||||
|
_GEOMETRY_FORM_CLS = SimpleGeomForm
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
|
||||||
|
class BaseNewSpatialLocatedObjectFormView(BaseSpatialLocatedObjectFormView):
|
||||||
|
|
||||||
|
def _user_has_permission(self, user):
|
||||||
|
# User has to have default privilege to call this endpoint
|
||||||
|
return user.is_default_user()
|
||||||
|
|
||||||
|
def _user_has_shared_access(self, user, **kwargs):
|
||||||
|
# There is no shared access control since nothing exists yet
|
||||||
|
return True
|
||||||
|
|
||||||
|
def get(self, request: HttpRequest, **kwargs):
|
||||||
|
form: BaseForm = self._FORM_CLS(None, **kwargs, user=request.user)
|
||||||
|
geom_form: SimpleGeomForm = self._GEOMETRY_FORM_CLS(None, user=request.user, read_only=False)
|
||||||
|
|
||||||
|
context = self._get_additional_context()
|
||||||
|
context = BaseContext(request, additional_context=context).context
|
||||||
|
context.update(
|
||||||
|
{
|
||||||
|
"form": form,
|
||||||
|
"geom_form": geom_form,
|
||||||
|
TAB_TITLE_IDENTIFIER: self._TAB_TITLE,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return render(request, self._TEMPLATE, context)
|
||||||
|
|
||||||
|
def post(self, request: HttpRequest, **kwargs):
|
||||||
|
form: BaseForm = self._FORM_CLS(request.POST or None, **kwargs, user=request.user)
|
||||||
|
geom_form: SimpleGeomForm = self._GEOMETRY_FORM_CLS(request.POST or None, user=request.user, read_only=False)
|
||||||
|
|
||||||
|
if form.is_valid() and geom_form.is_valid():
|
||||||
|
obj = form.save(request.user, geom_form)
|
||||||
|
obj_redirect_url = reverse(self._REDIRECT_URL, args=(obj.id,))
|
||||||
|
|
||||||
|
generated_identifier = form.cleaned_data.get("identifier", None)
|
||||||
|
|
||||||
|
if generated_identifier != obj.identifier:
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
IDENTIFIER_REPLACED.format(
|
||||||
|
generated_identifier,
|
||||||
|
obj.identifier
|
||||||
|
)
|
||||||
|
)
|
||||||
|
messages.success(request, _("{} added").format(obj.identifier))
|
||||||
|
if geom_form.has_geometry_simplified():
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
GEOMETRY_SIMPLIFIED
|
||||||
|
)
|
||||||
|
|
||||||
|
num_ignored_geometries = geom_form.get_num_geometries_ignored()
|
||||||
|
if num_ignored_geometries > 0:
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
GEOMETRIES_IGNORED_TEMPLATE.format(num_ignored_geometries)
|
||||||
|
)
|
||||||
|
|
||||||
|
return redirect(obj_redirect_url)
|
||||||
|
else:
|
||||||
|
context = self._get_additional_context()
|
||||||
|
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
||||||
|
|
||||||
|
context = BaseContext(request, additional_context=context).context
|
||||||
|
context.update(
|
||||||
|
{
|
||||||
|
"form": form,
|
||||||
|
"geom_form": geom_form,
|
||||||
|
TAB_TITLE_IDENTIFIER: self._TAB_TITLE,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return render(request, self._TEMPLATE, context)
|
||||||
|
|
||||||
|
|
||||||
|
class BaseEditSpatialLocatedObjectFormView(BaseSpatialLocatedObjectFormView):
|
||||||
|
_TAB_TITLE = _("Edit {}")
|
||||||
|
|
||||||
|
def get(self, request: HttpRequest, id: str):
|
||||||
|
obj = get_object_or_404(
|
||||||
|
self._MODEL_CLS,
|
||||||
|
id=id
|
||||||
|
)
|
||||||
|
obj_redirect_url = reverse(self._REDIRECT_URL, args=(obj.id,))
|
||||||
|
|
||||||
|
if obj.is_recorded:
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
RECORDED_BLOCKS_EDIT
|
||||||
|
)
|
||||||
|
return redirect(obj_redirect_url)
|
||||||
|
|
||||||
|
form: BaseForm = self._FORM_CLS(None, instance=obj, user=request.user)
|
||||||
|
geom_form: SimpleGeomForm = self._GEOMETRY_FORM_CLS(None, instance=obj, read_only=False)
|
||||||
|
|
||||||
|
context = self._get_additional_context()
|
||||||
|
context = BaseContext(request, additional_context=context).context
|
||||||
|
context.update(
|
||||||
|
{
|
||||||
|
"form": form,
|
||||||
|
"geom_form": geom_form,
|
||||||
|
TAB_TITLE_IDENTIFIER: self._TAB_TITLE.format(obj.identifier),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return render(request, self._TEMPLATE, context)
|
||||||
|
|
||||||
|
def post(self, request: HttpRequest, id: str):
|
||||||
|
obj = get_object_or_404(
|
||||||
|
self._MODEL_CLS,
|
||||||
|
id=id
|
||||||
|
)
|
||||||
|
obj_redirect_url = reverse(self._REDIRECT_URL, args=(obj.id,))
|
||||||
|
|
||||||
|
form: BaseForm = self._FORM_CLS(request.POST or None, instance=obj, user=request.user)
|
||||||
|
geom_form: SimpleGeomForm = self._GEOMETRY_FORM_CLS(request.POST or None, instance=obj, read_only=False)
|
||||||
|
|
||||||
|
if form.is_valid() and geom_form.is_valid():
|
||||||
|
obj = form.save(request.user, geom_form)
|
||||||
|
messages.success(request, _("{} edited").format(obj.identifier))
|
||||||
|
|
||||||
|
if geom_form.has_geometry_simplified():
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
GEOMETRY_SIMPLIFIED
|
||||||
|
)
|
||||||
|
|
||||||
|
num_ignored_geometries = geom_form.get_num_geometries_ignored()
|
||||||
|
if num_ignored_geometries > 0:
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
GEOMETRIES_IGNORED_TEMPLATE.format(num_ignored_geometries)
|
||||||
|
)
|
||||||
|
|
||||||
|
return redirect(obj_redirect_url)
|
||||||
|
else:
|
||||||
|
context = self._get_additional_context()
|
||||||
|
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
||||||
|
|
||||||
|
context = BaseContext(request, additional_context=context).context
|
||||||
|
context.update(
|
||||||
|
{
|
||||||
|
"form": form,
|
||||||
|
"geom_form": geom_form,
|
||||||
|
TAB_TITLE_IDENTIFIER: self._TAB_TITLE.format(obj.identifier),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return render(request, self._TEMPLATE, context)
|
||||||
|
|
||||||
|
def _user_has_shared_access(self, user, **kwargs):
|
||||||
|
obj = get_object_or_404(self._MODEL_CLS, id=kwargs.get('id', None))
|
||||||
|
return obj.is_shared_with(user)
|
||||||
|
|
||||||
|
def _user_has_permission(self, user):
|
||||||
|
return user.is_default_user()
|
||||||
@@ -6,30 +6,60 @@ Created on: 22.08.22
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.http import Http404
|
from django.http import Http404, HttpRequest
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.views import View
|
|
||||||
|
|
||||||
from intervention.forms.modals.deduction import NewEcoAccountDeductionModalForm, EditEcoAccountDeductionModalForm, \
|
from intervention.forms.modals.deduction import NewEcoAccountDeductionModalForm, EditEcoAccountDeductionModalForm, \
|
||||||
RemoveEcoAccountDeductionModalForm
|
RemoveEcoAccountDeductionModalForm
|
||||||
from konova.utils.message_templates import DEDUCTION_ADDED, DEDUCTION_EDITED, DEDUCTION_REMOVED, DEDUCTION_UNKNOWN
|
from konova.utils.message_templates import DEDUCTION_ADDED, DEDUCTION_EDITED, DEDUCTION_REMOVED, DEDUCTION_UNKNOWN
|
||||||
|
from konova.views.base import BaseModalFormView
|
||||||
|
|
||||||
|
|
||||||
class AbstractDeductionView(View):
|
class AbstractDeductionView(BaseModalFormView):
|
||||||
model = None
|
_MODEL = None
|
||||||
redirect_url = None
|
_REDIRECT_URL = None
|
||||||
|
|
||||||
def _custom_check(self, obj):
|
def _custom_check(self, obj):
|
||||||
"""
|
"""
|
||||||
Can be used by inheriting classes to provide custom checks before further processing
|
Can be used by inheriting classes to provide custom checks before further processing
|
||||||
|
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError("Must be implemented in subclasses")
|
pass
|
||||||
|
|
||||||
|
def _user_has_permission(self, user) -> bool:
|
||||||
|
"""
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
return user.is_default_user()
|
||||||
|
|
||||||
|
def _user_has_shared_access(self, user, **kwargs) -> bool:
|
||||||
|
""" A user has shared access on
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user (User): The performing user
|
||||||
|
kwargs (dict): Parameters
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: True if the user has access to the requested object, False otherwise
|
||||||
|
"""
|
||||||
|
ret_val: bool = False
|
||||||
|
try:
|
||||||
|
obj = self._MODEL.objects.get(
|
||||||
|
id=kwargs.get("id")
|
||||||
|
)
|
||||||
|
ret_val = obj.is_shared_with(user)
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
ret_val = False
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
|
||||||
class AbstractNewDeductionView(AbstractDeductionView):
|
class AbstractNewDeductionView(AbstractDeductionView):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
@@ -43,13 +73,13 @@ class AbstractNewDeductionView(AbstractDeductionView):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
obj = get_object_or_404(self.model, id=id)
|
obj = get_object_or_404(self._MODEL, id=id)
|
||||||
self._custom_check(obj)
|
self._custom_check(obj)
|
||||||
form = NewEcoAccountDeductionModalForm(request.POST or None, instance=obj, request=request)
|
form = NewEcoAccountDeductionModalForm(request.POST or None, instance=obj, request=request)
|
||||||
return form.process_request(
|
return form.process_request(
|
||||||
request,
|
request,
|
||||||
msg_success=DEDUCTION_ADDED,
|
msg_success=DEDUCTION_ADDED,
|
||||||
redirect_url=reverse(self.redirect_url, args=(id,)) + "#related_data",
|
redirect_url=reverse(self._REDIRECT_URL, args=(id,)) + "#related_data",
|
||||||
)
|
)
|
||||||
|
|
||||||
def post(self, request, id: str):
|
def post(self, request, id: str):
|
||||||
@@ -57,10 +87,6 @@ class AbstractNewDeductionView(AbstractDeductionView):
|
|||||||
|
|
||||||
|
|
||||||
class AbstractEditDeductionView(AbstractDeductionView):
|
class AbstractEditDeductionView(AbstractDeductionView):
|
||||||
|
|
||||||
def _custom_check(self, obj):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
@@ -75,7 +101,7 @@ class AbstractEditDeductionView(AbstractDeductionView):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
obj = get_object_or_404(self.model, id=id)
|
obj = get_object_or_404(self._MODEL, id=id)
|
||||||
self._custom_check(obj)
|
self._custom_check(obj)
|
||||||
try:
|
try:
|
||||||
eco_deduction = obj.deductions.get(id=deduction_id)
|
eco_deduction = obj.deductions.get(id=deduction_id)
|
||||||
@@ -87,7 +113,7 @@ class AbstractEditDeductionView(AbstractDeductionView):
|
|||||||
return form.process_request(
|
return form.process_request(
|
||||||
request=request,
|
request=request,
|
||||||
msg_success=DEDUCTION_EDITED,
|
msg_success=DEDUCTION_EDITED,
|
||||||
redirect_url=reverse(self.redirect_url, args=(id,)) + "#related_data"
|
redirect_url=reverse(self._REDIRECT_URL, args=(id,)) + "#related_data"
|
||||||
)
|
)
|
||||||
|
|
||||||
def post(self, request, id: str, deduction_id: str):
|
def post(self, request, id: str, deduction_id: str):
|
||||||
@@ -95,10 +121,6 @@ class AbstractEditDeductionView(AbstractDeductionView):
|
|||||||
|
|
||||||
|
|
||||||
class AbstractRemoveDeductionView(AbstractDeductionView):
|
class AbstractRemoveDeductionView(AbstractDeductionView):
|
||||||
|
|
||||||
def _custom_check(self, obj):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
@@ -113,7 +135,7 @@ class AbstractRemoveDeductionView(AbstractDeductionView):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
obj = get_object_or_404(self.model, id=id)
|
obj = get_object_or_404(self._MODEL, id=id)
|
||||||
self._custom_check(obj)
|
self._custom_check(obj)
|
||||||
try:
|
try:
|
||||||
eco_deduction = obj.deductions.get(id=deduction_id)
|
eco_deduction = obj.deductions.get(id=deduction_id)
|
||||||
@@ -124,7 +146,7 @@ class AbstractRemoveDeductionView(AbstractDeductionView):
|
|||||||
return form.process_request(
|
return form.process_request(
|
||||||
request=request,
|
request=request,
|
||||||
msg_success=DEDUCTION_REMOVED,
|
msg_success=DEDUCTION_REMOVED,
|
||||||
redirect_url=reverse(self.redirect_url, args=(id,)) + "#related_data"
|
redirect_url=reverse(self._REDIRECT_URL, args=(id,)) + "#related_data"
|
||||||
)
|
)
|
||||||
|
|
||||||
def post(self, request, id: str, deduction_id: str):
|
def post(self, request, id: str, deduction_id: str):
|
||||||
|
|||||||
107
konova/views/detail.py
Normal file
107
konova/views/detail.py
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Created on: 17.10.25
|
||||||
|
|
||||||
|
"""
|
||||||
|
from abc import abstractmethod
|
||||||
|
|
||||||
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
|
from django.http import HttpRequest
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
from konova.contexts import BaseContext
|
||||||
|
from konova.forms import SimpleGeomForm
|
||||||
|
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
|
||||||
|
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||||
|
from konova.utils.general import check_id_is_valid_uuid
|
||||||
|
from konova.utils.message_templates import DO_NOT_FORGET_TO_SHARE
|
||||||
|
from konova.views.base import BaseView
|
||||||
|
|
||||||
|
|
||||||
|
class BaseDetailView(LoginRequiredMixin, BaseView):
|
||||||
|
_MODEL_CLS = None
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
def dispatch(self, request, *args, **kwargs):
|
||||||
|
check_id_is_valid_uuid(**kwargs)
|
||||||
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
|
def _user_has_shared_access(self, user, **kwargs):
|
||||||
|
""" Check if user has shared access to this object
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user ():
|
||||||
|
**kwargs ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
# Access to an entry's detail view is not restricted by the state of being-shared or not
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _user_has_permission(self, user):
|
||||||
|
# Detail views have no restrictions
|
||||||
|
return True
|
||||||
|
|
||||||
|
def get(self, request: HttpRequest, id: str):
|
||||||
|
""" Get endpoint for detail view
|
||||||
|
|
||||||
|
Args:
|
||||||
|
request (HttpRequest): The incoming request
|
||||||
|
id (str): The record's id
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
obj = self._get_object(id)
|
||||||
|
geom_form = SimpleGeomForm(instance=obj)
|
||||||
|
user = request.user
|
||||||
|
|
||||||
|
requesting_user_is_only_shared_user = obj.is_only_shared_with(user)
|
||||||
|
if requesting_user_is_only_shared_user:
|
||||||
|
messages.info(request, DO_NOT_FORGET_TO_SHARE)
|
||||||
|
|
||||||
|
obj.set_status_messages(request)
|
||||||
|
|
||||||
|
detail_context = self._get_detail_context(obj)
|
||||||
|
context = BaseContext(request, detail_context).context
|
||||||
|
context.update(
|
||||||
|
{
|
||||||
|
"obj": obj,
|
||||||
|
"geom_form": geom_form,
|
||||||
|
"is_default_member": user.in_group(DEFAULT_GROUP),
|
||||||
|
"is_zb_member": user.in_group(ZB_GROUP),
|
||||||
|
"is_ets_member": user.in_group(ETS_GROUP),
|
||||||
|
"LANIS_LINK": obj.get_LANIS_link(),
|
||||||
|
"is_entry_shared": obj.is_shared_with(user=user),
|
||||||
|
TAB_TITLE_IDENTIFIER: f"{obj.identifier} - {obj.title}"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return render(request,self._TEMPLATE, context)
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def _get_detail_context(self, obj):
|
||||||
|
""" Generate object specific detail context for view
|
||||||
|
|
||||||
|
Args:
|
||||||
|
obj (): The record
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def _get_object(self, id: str):
|
||||||
|
""" Fetch object for detail view
|
||||||
|
|
||||||
|
Args:
|
||||||
|
id (str): The record's id'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
@@ -25,6 +25,20 @@ def get_404_view(request: HttpRequest, exception=None):
|
|||||||
return render(request, "404.html", context, status=404)
|
return render(request, "404.html", context, status=404)
|
||||||
|
|
||||||
|
|
||||||
|
def get_400_view(request: HttpRequest, exception=None):
|
||||||
|
""" Returns a 400 handling view
|
||||||
|
|
||||||
|
Args:
|
||||||
|
request ():
|
||||||
|
exception ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
context = BaseContext.context
|
||||||
|
return render(request, "400.html", context, status=400)
|
||||||
|
|
||||||
|
|
||||||
def get_500_view(request: HttpRequest):
|
def get_500_view(request: HttpRequest):
|
||||||
""" Returns a 404 handling view
|
""" Returns a 404 handling view
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ Contact: ksp-servicestelle@sgdnord.rlp.de
|
|||||||
Created on: 19.08.22
|
Created on: 19.08.22
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
||||||
from django.contrib.gis.geos import MultiPolygon
|
from django.contrib.gis.geos import MultiPolygon
|
||||||
from django.http import HttpResponse, HttpRequest
|
from django.http import HttpResponse, HttpRequest
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
|
|||||||
@@ -9,21 +9,19 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
|||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.utils.decorators import method_decorator
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views import View
|
|
||||||
|
|
||||||
from compensation.models import EcoAccount, Compensation
|
from compensation.models import EcoAccount, Compensation
|
||||||
from intervention.models import Intervention
|
from intervention.models import Intervention
|
||||||
from konova.contexts import BaseContext
|
from konova.contexts import BaseContext
|
||||||
from konova.decorators import any_group_check
|
|
||||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||||
|
from konova.views.base import BaseView
|
||||||
from news.models import ServerMessage
|
from news.models import ServerMessage
|
||||||
|
|
||||||
|
|
||||||
class HomeView(LoginRequiredMixin, View):
|
class HomeView(LoginRequiredMixin, BaseView):
|
||||||
|
_TEMPLATE = "konova/home.html"
|
||||||
|
|
||||||
@method_decorator(any_group_check)
|
|
||||||
def get(self, request: HttpRequest):
|
def get(self, request: HttpRequest):
|
||||||
"""
|
"""
|
||||||
Renders the landing page
|
Renders the landing page
|
||||||
@@ -34,7 +32,6 @@ class HomeView(LoginRequiredMixin, View):
|
|||||||
Returns:
|
Returns:
|
||||||
A redirect
|
A redirect
|
||||||
"""
|
"""
|
||||||
template = "konova/home.html"
|
|
||||||
user = request.user
|
user = request.user
|
||||||
user_teams = user.shared_teams
|
user_teams = user.shared_teams
|
||||||
|
|
||||||
@@ -75,5 +72,12 @@ class HomeView(LoginRequiredMixin, View):
|
|||||||
TAB_TITLE_IDENTIFIER: _("Home"),
|
TAB_TITLE_IDENTIFIER: _("Home"),
|
||||||
}
|
}
|
||||||
context = BaseContext(request, additional_context).context
|
context = BaseContext(request, additional_context).context
|
||||||
return render(request, template, context)
|
return render(request, self._TEMPLATE, context)
|
||||||
|
|
||||||
|
def _user_has_permission(self, user):
|
||||||
|
# No specific permission needed for home view
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _user_has_shared_access(self, user, **kwargs):
|
||||||
|
# No specific constraint needed for home view
|
||||||
|
return True
|
||||||
|
|||||||
@@ -24,5 +24,13 @@ class LogoutView(View):
|
|||||||
Returns:
|
Returns:
|
||||||
A redirect
|
A redirect
|
||||||
"""
|
"""
|
||||||
|
user = request.user
|
||||||
|
try:
|
||||||
|
oauth_token = user.oauth_token
|
||||||
|
if oauth_token:
|
||||||
|
oauth_token.revoke()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
logout(request)
|
logout(request)
|
||||||
return redirect(SSO_SERVER_BASE)
|
return redirect(SSO_SERVER_BASE)
|
||||||
|
|||||||
@@ -9,28 +9,31 @@ import json
|
|||||||
from json import JSONDecodeError
|
from json import JSONDecodeError
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from django.contrib.auth.decorators import login_required
|
import urllib3.util
|
||||||
from django.http import JsonResponse, HttpRequest
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.utils.decorators import method_decorator
|
from django.http import JsonResponse, HttpRequest, HttpResponse
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
from django.views import View
|
from django.views import View
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
|
|
||||||
from requests.auth import HTTPDigestAuth
|
from requests.auth import HTTPDigestAuth
|
||||||
|
|
||||||
|
from konova.sub_settings.lanis_settings import MAP_PROXY_HOST_WHITELIST
|
||||||
from konova.sub_settings.proxy_settings import PROXIES, GEOPORTAL_RLP_USER, GEOPORTAL_RLP_PASSWORD
|
from konova.sub_settings.proxy_settings import PROXIES, GEOPORTAL_RLP_USER, GEOPORTAL_RLP_PASSWORD
|
||||||
|
|
||||||
|
|
||||||
class BaseClientProxyView(View):
|
class BaseClientProxyView(LoginRequiredMixin, View):
|
||||||
""" Provides proxy functionality for NETGIS map client.
|
""" Provides proxy functionality for NETGIS map client.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
@method_decorator(login_required)
|
def _check_with_whitelist(self, url):
|
||||||
def dispatch(self, request, *args, **kwargs):
|
parsed_url = urllib3.util.parse_url(url)
|
||||||
return super().dispatch(request, *args, **kwargs)
|
parsed_url_host = parsed_url.host
|
||||||
|
whitelist = set(MAP_PROXY_HOST_WHITELIST)
|
||||||
|
is_allowed = parsed_url_host in whitelist
|
||||||
|
return is_allowed
|
||||||
|
|
||||||
def perform_url_call(self, url, headers={}, auth=None):
|
def perform_url_call(self, url, headers={}, auth=None):
|
||||||
""" Generic proxied call
|
""" Generic proxied call
|
||||||
@@ -51,33 +54,23 @@ class BaseClientProxyView(View):
|
|||||||
)
|
)
|
||||||
content = response.content
|
content = response.content
|
||||||
if isinstance(content, bytes):
|
if isinstance(content, bytes):
|
||||||
content = content.decode("utf-8")
|
try:
|
||||||
|
content = content.decode("utf-8")
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
content = f"Can not decode content of {url}"
|
||||||
return content, response.status_code
|
return content, response.status_code
|
||||||
|
|
||||||
|
|
||||||
class ClientProxyParcelSearch(BaseClientProxyView):
|
class ClientProxyParcelSearch(BaseClientProxyView):
|
||||||
|
|
||||||
def get(self, request: HttpRequest):
|
def get(self, request: HttpRequest):
|
||||||
url = request.META.get("QUERY_STRING")
|
url = request.META.get("QUERY_STRING")
|
||||||
content, response_code = self.perform_url_call(url)
|
|
||||||
try:
|
|
||||||
body = json.loads(content)
|
|
||||||
except JSONDecodeError as e:
|
|
||||||
body = {
|
|
||||||
"totalResultsCount": -1,
|
|
||||||
"geonames": [
|
|
||||||
{
|
|
||||||
"title": _("The external service is currently unavailable.<br>Please try again in a few moments...")
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if response_code != 200:
|
is_url_allowed = self._check_with_whitelist(url)
|
||||||
return JsonResponse({
|
if not is_url_allowed:
|
||||||
"status_code": response_code,
|
raise PermissionError(f"Proxied url '{url}' is not allowed!")
|
||||||
"content": body,
|
|
||||||
})
|
content, response_code = self.perform_url_call(url)
|
||||||
return JsonResponse(body)
|
return HttpResponse(content)
|
||||||
|
|
||||||
|
|
||||||
class ClientProxyParcelWFS(BaseClientProxyView):
|
class ClientProxyParcelWFS(BaseClientProxyView):
|
||||||
|
|||||||
@@ -115,10 +115,10 @@ class OAuthCallbackView(View):
|
|||||||
if status_code_invalid:
|
if status_code_invalid:
|
||||||
raise RuntimeError(f"OAuth access token could not be fetched: {access_code_response.text}")
|
raise RuntimeError(f"OAuth access token could not be fetched: {access_code_response.text}")
|
||||||
|
|
||||||
oauth_access_token = OAuthToken.from_access_token_response(access_code_response_body, received_on)
|
oauth_token = OAuthToken.from_access_token_response(access_code_response_body, received_on)
|
||||||
oauth_access_token.save()
|
oauth_token.save()
|
||||||
user = oauth_access_token.update_and_get_user()
|
user = oauth_token.update_and_get_user()
|
||||||
user.oauth_replace_token(oauth_access_token)
|
user.oauth_replace_token(oauth_token)
|
||||||
|
|
||||||
login(request, user)
|
login(request, user)
|
||||||
return redirect("home")
|
return redirect("home")
|
||||||
|
|||||||
106
konova/views/report.py
Normal file
106
konova/views/report.py
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Created on: 17.10.25
|
||||||
|
|
||||||
|
"""
|
||||||
|
from abc import abstractmethod
|
||||||
|
from uuid import UUID
|
||||||
|
|
||||||
|
from django.http import HttpRequest, Http404
|
||||||
|
from django.shortcuts import get_object_or_404, render
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
from konova.contexts import BaseContext
|
||||||
|
from konova.forms import SimpleGeomForm
|
||||||
|
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||||
|
from konova.views.base import BaseView
|
||||||
|
|
||||||
|
|
||||||
|
class BaseReportView(BaseView):
|
||||||
|
_TEMPLATE = None
|
||||||
|
_TAB_TITLE = _("Report {}")
|
||||||
|
_MODEL = None
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
def dispatch(self, request, *args, **kwargs):
|
||||||
|
# If the given id is not a uuid we act as the result was not found
|
||||||
|
try:
|
||||||
|
UUID(kwargs.get('id'))
|
||||||
|
except ValueError:
|
||||||
|
raise Http404()
|
||||||
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
|
def _return_unpublishable_content_response(self, request: HttpRequest, tab_title: str):
|
||||||
|
""" Handles HttpResponse return in case the object is not ready for publish
|
||||||
|
|
||||||
|
Args:
|
||||||
|
request ():
|
||||||
|
tab_title ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
template = "report/unavailable.html"
|
||||||
|
context = {
|
||||||
|
TAB_TITLE_IDENTIFIER: tab_title,
|
||||||
|
}
|
||||||
|
context = BaseContext(request, context).context
|
||||||
|
return render(request, template, context)
|
||||||
|
|
||||||
|
def get(self, request: HttpRequest, id: str):
|
||||||
|
""" Renders the public report view
|
||||||
|
|
||||||
|
Args:
|
||||||
|
request (HttpRequest): The incoming request
|
||||||
|
id (str): The id of the intervention
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
obj = get_object_or_404(self._MODEL, id=id)
|
||||||
|
tab_title = self._TAB_TITLE.format(obj.identifier)
|
||||||
|
|
||||||
|
# If object is not recorded we need to render another template without any data
|
||||||
|
if not obj.is_ready_for_publish():
|
||||||
|
return self._return_unpublishable_content_response(request, tab_title)
|
||||||
|
|
||||||
|
# First get specific report context for different types of objects due to inheritance
|
||||||
|
report_context = self._get_report_context(obj)
|
||||||
|
|
||||||
|
# Then generate and add default report context (the same for all models)
|
||||||
|
geom_form = SimpleGeomForm(instance=obj)
|
||||||
|
parcels = obj.get_underlying_parcels()
|
||||||
|
report_context.update(
|
||||||
|
{
|
||||||
|
TAB_TITLE_IDENTIFIER: tab_title,
|
||||||
|
"parcels": parcels,
|
||||||
|
"geom_form": geom_form,
|
||||||
|
"obj": obj
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Then generate the general context based on the report specific data
|
||||||
|
context = BaseContext(request, report_context).context
|
||||||
|
return render(request, self._TEMPLATE, context)
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def _get_report_context(self, obj):
|
||||||
|
""" Returns the specific context needed for this report view
|
||||||
|
|
||||||
|
Args:
|
||||||
|
obj (RecordableObjectMixin): The object for the report
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: The object specific context for rendering the report
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def _user_has_permission(self, user):
|
||||||
|
# Reports do not need specific permissions to be callable
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _user_has_shared_access(self, user, **kwargs):
|
||||||
|
# Reports do not need specific share states to be callable
|
||||||
|
return True
|
||||||
Binary file not shown.
@@ -29,6 +29,7 @@
|
|||||||
#: konova/filters/mixins/office.py:25 konova/filters/mixins/office.py:56
|
#: konova/filters/mixins/office.py:25 konova/filters/mixins/office.py:56
|
||||||
#: konova/filters/mixins/office.py:57 konova/filters/mixins/record.py:23
|
#: konova/filters/mixins/office.py:57 konova/filters/mixins/record.py:23
|
||||||
#: konova/filters/mixins/self_created.py:24 konova/filters/mixins/share.py:23
|
#: konova/filters/mixins/self_created.py:24 konova/filters/mixins/share.py:23
|
||||||
|
#: konova/filters/mixins/user_log.py:17 konova/filters/mixins/user_log.py:18
|
||||||
#: konova/forms/geometry_form.py:32 konova/forms/modals/document_form.py:26
|
#: konova/forms/geometry_form.py:32 konova/forms/modals/document_form.py:26
|
||||||
#: konova/forms/modals/document_form.py:36
|
#: konova/forms/modals/document_form.py:36
|
||||||
#: konova/forms/modals/document_form.py:50
|
#: konova/forms/modals/document_form.py:50
|
||||||
@@ -37,13 +38,14 @@
|
|||||||
#: konova/forms/modals/remove_form.py:23
|
#: konova/forms/modals/remove_form.py:23
|
||||||
#: konova/forms/modals/resubmission_form.py:22
|
#: konova/forms/modals/resubmission_form.py:22
|
||||||
#: konova/forms/modals/resubmission_form.py:38 konova/forms/remove_form.py:25
|
#: konova/forms/modals/resubmission_form.py:38 konova/forms/remove_form.py:25
|
||||||
#: konova/tests/unit/test_forms.py:59 user/forms/user.py:39
|
#: konova/tests/unit/test_forms.py:59 user/forms/modals/api_token.py:17
|
||||||
|
#: user/forms/user.py:39
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-02-16 09:49+0100\n"
|
"POT-Creation-Date: 2025-10-19 13:56+0200\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@@ -259,7 +261,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:14
|
#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:14
|
||||||
#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:16
|
#: analysis/templates/analysis/reports/includes/eco_account/deductions.html:16
|
||||||
#: compensation/forms/modals/state.py:58
|
#: compensation/forms/modals/state.py:59
|
||||||
#: compensation/templates/compensation/detail/compensation/includes/states-after.html:36
|
#: compensation/templates/compensation/detail/compensation/includes/states-after.html:36
|
||||||
#: compensation/templates/compensation/detail/compensation/includes/states-before.html:36
|
#: compensation/templates/compensation/detail/compensation/includes/states-before.html:36
|
||||||
#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:36
|
#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:36
|
||||||
@@ -372,7 +374,6 @@ msgid "Identifier"
|
|||||||
msgstr "Kennung"
|
msgstr "Kennung"
|
||||||
|
|
||||||
#: compensation/forms/compensation.py:33 intervention/forms/intervention.py:33
|
#: compensation/forms/compensation.py:33 intervention/forms/intervention.py:33
|
||||||
#: user/forms/user.py:77
|
|
||||||
msgid "Generated automatically - not editable"
|
msgid "Generated automatically - not editable"
|
||||||
msgstr "Automatisch generiert - nicht bearbeitbar"
|
msgstr "Automatisch generiert - nicht bearbeitbar"
|
||||||
|
|
||||||
@@ -447,11 +448,19 @@ msgid "Select the intervention for which this compensation compensates"
|
|||||||
msgstr "Wählen Sie den Eingriff, für den diese Kompensation bestimmt ist"
|
msgstr "Wählen Sie den Eingriff, für den diese Kompensation bestimmt ist"
|
||||||
|
|
||||||
#: compensation/forms/compensation.py:114
|
#: compensation/forms/compensation.py:114
|
||||||
#: compensation/views/compensation/compensation.py:119
|
#: compensation/views/compensation/compensation.py:161
|
||||||
msgid "New compensation"
|
msgid "New compensation"
|
||||||
msgstr "Neue Kompensation"
|
msgstr "Neue Kompensation"
|
||||||
|
|
||||||
#: compensation/forms/compensation.py:190
|
#: compensation/forms/compensation.py:179
|
||||||
|
msgid ""
|
||||||
|
"This intervention is currently recorded. You cannot add further "
|
||||||
|
"compensations as long as it is recorded."
|
||||||
|
msgstr ""
|
||||||
|
"Dieser Eingriff ist derzeit verzeichnet. "
|
||||||
|
"Sie können keine weiteren Kompensationen hinzufügen, so lange er verzeichnet ist."
|
||||||
|
|
||||||
|
#: compensation/forms/compensation.py:202
|
||||||
msgid "Edit compensation"
|
msgid "Edit compensation"
|
||||||
msgstr "Bearbeite Kompensation"
|
msgstr "Bearbeite Kompensation"
|
||||||
|
|
||||||
@@ -474,7 +483,7 @@ msgid "When did the parties agree on this?"
|
|||||||
msgstr "Wann wurde dieses Ökokonto offiziell vereinbart?"
|
msgstr "Wann wurde dieses Ökokonto offiziell vereinbart?"
|
||||||
|
|
||||||
#: compensation/forms/eco_account.py:72
|
#: compensation/forms/eco_account.py:72
|
||||||
#: compensation/views/eco_account/eco_account.py:100
|
#: compensation/views/eco_account/eco_account.py:93
|
||||||
msgid "New Eco-Account"
|
msgid "New Eco-Account"
|
||||||
msgstr "Neues Ökokonto"
|
msgstr "Neues Ökokonto"
|
||||||
|
|
||||||
@@ -696,46 +705,46 @@ msgid "If there is no date you can enter, please explain why."
|
|||||||
msgstr "Falls Sie kein Datum angeben können, erklären Sie bitte weshalb."
|
msgstr "Falls Sie kein Datum angeben können, erklären Sie bitte weshalb."
|
||||||
|
|
||||||
#: compensation/forms/modals/payment.py:108
|
#: compensation/forms/modals/payment.py:108
|
||||||
#: intervention/templates/intervention/detail/includes/payments.html:59
|
#: intervention/templates/intervention/detail/includes/payments.html:67
|
||||||
msgid "Edit payment"
|
msgid "Edit payment"
|
||||||
msgstr "Zahlung bearbeiten"
|
msgstr "Zahlung bearbeiten"
|
||||||
|
|
||||||
#: compensation/forms/modals/state.py:32
|
#: compensation/forms/modals/state.py:33
|
||||||
msgid "Biotope Type"
|
msgid "Biotope Type"
|
||||||
msgstr "Biotoptyp"
|
msgstr "Biotoptyp"
|
||||||
|
|
||||||
#: compensation/forms/modals/state.py:35
|
#: compensation/forms/modals/state.py:36
|
||||||
msgid "Select the biotope type"
|
msgid "Select the biotope type"
|
||||||
msgstr "Biotoptyp wählen"
|
msgstr "Biotoptyp wählen"
|
||||||
|
|
||||||
#: compensation/forms/modals/state.py:39 compensation/forms/modals/state.py:51
|
#: compensation/forms/modals/state.py:40 compensation/forms/modals/state.py:52
|
||||||
msgid "Biotope additional type"
|
msgid "Biotope additional type"
|
||||||
msgstr "Zusatzbezeichnung"
|
msgstr "Zusatzbezeichnung"
|
||||||
|
|
||||||
#: compensation/forms/modals/state.py:42
|
#: compensation/forms/modals/state.py:43
|
||||||
msgid "Select an additional biotope type"
|
msgid "Select an additional biotope type"
|
||||||
msgstr "Zusatzbezeichnung wählen"
|
msgstr "Zusatzbezeichnung wählen"
|
||||||
|
|
||||||
#: compensation/forms/modals/state.py:61
|
#: compensation/forms/modals/state.py:62
|
||||||
#: intervention/forms/modals/deduction.py:49
|
#: intervention/forms/modals/deduction.py:49
|
||||||
msgid "in m²"
|
msgid "in m²"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: compensation/forms/modals/state.py:72
|
#: compensation/forms/modals/state.py:73
|
||||||
#: compensation/tests/compensation/unit/test_forms.py:175
|
#: compensation/tests/compensation/unit/test_forms.py:175
|
||||||
msgid "New state"
|
msgid "New state"
|
||||||
msgstr "Neuer Zustand"
|
msgstr "Neuer Zustand"
|
||||||
|
|
||||||
#: compensation/forms/modals/state.py:73
|
#: compensation/forms/modals/state.py:74
|
||||||
#: compensation/tests/compensation/unit/test_forms.py:176
|
#: compensation/tests/compensation/unit/test_forms.py:176
|
||||||
msgid "Insert data for the new state"
|
msgid "Insert data for the new state"
|
||||||
msgstr "Geben Sie die Daten des neuen Zustandes ein"
|
msgstr "Geben Sie die Daten des neuen Zustandes ein"
|
||||||
|
|
||||||
#: compensation/forms/modals/state.py:90 konova/forms/modals/base_form.py:32
|
#: compensation/forms/modals/state.py:91 konova/forms/modals/base_form.py:32
|
||||||
msgid "Object removed"
|
msgid "Object removed"
|
||||||
msgstr "Objekt entfernt"
|
msgstr "Objekt entfernt"
|
||||||
|
|
||||||
#: compensation/forms/modals/state.py:145
|
#: compensation/forms/modals/state.py:146
|
||||||
#: compensation/templates/compensation/detail/compensation/includes/states-after.html:62
|
#: compensation/templates/compensation/detail/compensation/includes/states-after.html:62
|
||||||
#: compensation/templates/compensation/detail/compensation/includes/states-before.html:62
|
#: compensation/templates/compensation/detail/compensation/includes/states-before.html:62
|
||||||
#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:62
|
#: compensation/templates/compensation/detail/eco_account/includes/states-after.html:62
|
||||||
@@ -1287,44 +1296,45 @@ msgstr ""
|
|||||||
msgid "Responsible data"
|
msgid "Responsible data"
|
||||||
msgstr "Daten zu den verantwortlichen Stellen"
|
msgstr "Daten zu den verantwortlichen Stellen"
|
||||||
|
|
||||||
#: compensation/views/compensation/compensation.py:57
|
#: compensation/views/compensation/compensation.py:35
|
||||||
msgid "Compensations - Overview"
|
msgid "Compensations - Overview"
|
||||||
msgstr "Kompensationen - Übersicht"
|
msgstr "Kompensationen - Übersicht"
|
||||||
|
|
||||||
#: compensation/views/compensation/compensation.py:180
|
#: compensation/views/compensation/compensation.py:52
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "New compensation"
|
||||||
|
msgid "New Compensation"
|
||||||
|
msgstr "Neue Kompensation"
|
||||||
|
|
||||||
|
#: compensation/views/compensation/compensation.py:208
|
||||||
#: konova/utils/message_templates.py:40
|
#: konova/utils/message_templates.py:40
|
||||||
msgid "Compensation {} edited"
|
msgid "Compensation {} edited"
|
||||||
msgstr "Kompensation {} bearbeitet"
|
msgstr "Kompensation {} bearbeitet"
|
||||||
|
|
||||||
#: compensation/views/compensation/compensation.py:195
|
#: compensation/views/compensation/compensation.py:231
|
||||||
#: compensation/views/eco_account/eco_account.py:172 ema/views/ema.py:230
|
#: compensation/views/eco_account/eco_account.py:159 ema/views/ema.py:59
|
||||||
#: intervention/views/intervention.py:251
|
#: intervention/views/intervention.py:59 intervention/views/intervention.py:179
|
||||||
|
#: konova/views/base.py:239
|
||||||
msgid "Edit {}"
|
msgid "Edit {}"
|
||||||
msgstr "Bearbeite {}"
|
msgstr "Bearbeite {}"
|
||||||
|
|
||||||
#: compensation/views/compensation/report.py:34
|
#: compensation/views/eco_account/eco_account.py:32
|
||||||
#: compensation/views/eco_account/report.py:34 ema/views/report.py:34
|
|
||||||
#: intervention/views/report.py:37
|
|
||||||
msgid "Report {}"
|
|
||||||
msgstr "Bericht {}"
|
|
||||||
|
|
||||||
#: compensation/views/eco_account/eco_account.py:52
|
|
||||||
msgid "Eco-account - Overview"
|
msgid "Eco-account - Overview"
|
||||||
msgstr "Ökokonten - Übersicht"
|
msgstr "Ökokonten - Übersicht"
|
||||||
|
|
||||||
#: compensation/views/eco_account/eco_account.py:85
|
#: compensation/views/eco_account/eco_account.py:70
|
||||||
msgid "Eco-Account {} added"
|
msgid "Eco-Account {} added"
|
||||||
msgstr "Ökokonto {} hinzugefügt"
|
msgstr "Ökokonto {} hinzugefügt"
|
||||||
|
|
||||||
#: compensation/views/eco_account/eco_account.py:157
|
#: compensation/views/eco_account/eco_account.py:136
|
||||||
msgid "Eco-Account {} edited"
|
msgid "Eco-Account {} edited"
|
||||||
msgstr "Ökokonto {} bearbeitet"
|
msgstr "Ökokonto {} bearbeitet"
|
||||||
|
|
||||||
#: compensation/views/eco_account/eco_account.py:286
|
#: compensation/views/eco_account/eco_account.py:260
|
||||||
msgid "Eco-account removed"
|
msgid "Eco-account removed"
|
||||||
msgstr "Ökokonto entfernt"
|
msgstr "Ökokonto entfernt"
|
||||||
|
|
||||||
#: ema/forms.py:42 ema/tests/unit/test_forms.py:27 ema/views/ema.py:101
|
#: ema/forms.py:42 ema/tests/unit/test_forms.py:27 ema/views/ema.py:42
|
||||||
msgid "New EMA"
|
msgid "New EMA"
|
||||||
msgstr "Neue EMA hinzufügen"
|
msgstr "Neue EMA hinzufügen"
|
||||||
|
|
||||||
@@ -1352,19 +1362,11 @@ msgstr ""
|
|||||||
msgid "Payment funded compensation"
|
msgid "Payment funded compensation"
|
||||||
msgstr "Ersatzzahlungsmaßnahme"
|
msgstr "Ersatzzahlungsmaßnahme"
|
||||||
|
|
||||||
#: ema/views/ema.py:52
|
#: ema/views/ema.py:26
|
||||||
msgid "EMAs - Overview"
|
msgid "EMAs - Overview"
|
||||||
msgstr "EMAs - Übersicht"
|
msgstr "EMAs - Übersicht"
|
||||||
|
|
||||||
#: ema/views/ema.py:85
|
#: ema/views/ema.py:138
|
||||||
msgid "EMA {} added"
|
|
||||||
msgstr "EMA {} hinzugefügt"
|
|
||||||
|
|
||||||
#: ema/views/ema.py:215
|
|
||||||
msgid "EMA {} edited"
|
|
||||||
msgstr "EMA {} bearbeitet"
|
|
||||||
|
|
||||||
#: ema/views/ema.py:254
|
|
||||||
msgid "EMA removed"
|
msgid "EMA removed"
|
||||||
msgstr "EMA entfernt"
|
msgstr "EMA entfernt"
|
||||||
|
|
||||||
@@ -1428,7 +1430,7 @@ msgstr "Datum Bestandskraft bzw. Rechtskraft"
|
|||||||
|
|
||||||
#: intervention/forms/intervention.py:216
|
#: intervention/forms/intervention.py:216
|
||||||
#: intervention/tests/unit/test_forms.py:36
|
#: intervention/tests/unit/test_forms.py:36
|
||||||
#: intervention/views/intervention.py:104
|
#: intervention/views/intervention.py:51
|
||||||
msgid "New intervention"
|
msgid "New intervention"
|
||||||
msgstr "Neuer Eingriff"
|
msgstr "Neuer Eingriff"
|
||||||
|
|
||||||
@@ -1597,7 +1599,12 @@ msgctxt "money"
|
|||||||
msgid "Amount"
|
msgid "Amount"
|
||||||
msgstr "Betrag"
|
msgstr "Betrag"
|
||||||
|
|
||||||
#: intervention/templates/intervention/detail/includes/payments.html:62
|
#: intervention/templates/intervention/detail/includes/payments.html:61
|
||||||
|
#: konova/utils/message_templates.py:25
|
||||||
|
msgid "This data is not shared with you"
|
||||||
|
msgstr "Diese Daten sind für Sie nicht freigegeben"
|
||||||
|
|
||||||
|
#: intervention/templates/intervention/detail/includes/payments.html:70
|
||||||
msgid "Remove payment"
|
msgid "Remove payment"
|
||||||
msgstr "Zahlung entfernen"
|
msgstr "Zahlung entfernen"
|
||||||
|
|
||||||
@@ -1659,19 +1666,15 @@ msgstr ""
|
|||||||
msgid "Check performed"
|
msgid "Check performed"
|
||||||
msgstr "Prüfung durchgeführt"
|
msgstr "Prüfung durchgeführt"
|
||||||
|
|
||||||
#: intervention/views/intervention.py:56
|
#: intervention/views/intervention.py:33
|
||||||
msgid "Interventions - Overview"
|
msgid "Interventions - Overview"
|
||||||
msgstr "Eingriffe - Übersicht"
|
msgstr "Eingriffe - Übersicht"
|
||||||
|
|
||||||
#: intervention/views/intervention.py:89
|
#: intervention/views/intervention.py:154
|
||||||
msgid "Intervention {} added"
|
|
||||||
msgstr "Eingriff {} hinzugefügt"
|
|
||||||
|
|
||||||
#: intervention/views/intervention.py:234
|
|
||||||
msgid "Intervention {} edited"
|
msgid "Intervention {} edited"
|
||||||
msgstr "Eingriff {} bearbeitet"
|
msgstr "Eingriff {} bearbeitet"
|
||||||
|
|
||||||
#: intervention/views/intervention.py:276
|
#: intervention/views/intervention.py:204
|
||||||
msgid "{} removed"
|
msgid "{} removed"
|
||||||
msgstr "{} entfernt"
|
msgstr "{} entfernt"
|
||||||
|
|
||||||
@@ -1683,7 +1686,7 @@ msgstr "Hierfür müssen Sie Mitarbeiter sein!"
|
|||||||
msgid "You need to be administrator to perform this action!"
|
msgid "You need to be administrator to perform this action!"
|
||||||
msgstr "Hierfür müssen Sie Administrator sein!"
|
msgstr "Hierfür müssen Sie Administrator sein!"
|
||||||
|
|
||||||
#: konova/decorators.py:65
|
#: konova/decorators.py:65 konova/utils/general.py:40
|
||||||
msgid ""
|
msgid ""
|
||||||
"+++ Attention: You are not part of any group. You won't be able to create, "
|
"+++ Attention: You are not part of any group. You won't be able to create, "
|
||||||
"edit or do anything. Please contact an administrator. +++"
|
"edit or do anything. Please contact an administrator. +++"
|
||||||
@@ -1781,11 +1784,21 @@ msgstr ""
|
|||||||
"Wenn aktiviert werden auch Einträge angezeigt, die nicht für Sie freigegeben "
|
"Wenn aktiviert werden auch Einträge angezeigt, die nicht für Sie freigegeben "
|
||||||
"sind"
|
"sind"
|
||||||
|
|
||||||
|
#: konova/filters/mixins/user_log.py:21
|
||||||
|
msgid "Logged user"
|
||||||
|
msgstr "Bearbeitender Nutzer"
|
||||||
|
|
||||||
|
#: konova/filters/mixins/user_log.py:22
|
||||||
|
msgid ""
|
||||||
|
"Search for entries where this person has been participated according to log "
|
||||||
|
"history"
|
||||||
|
msgstr "Sucht nach Einträgen, an denen diese Person gearbeitet hat"
|
||||||
|
|
||||||
#: konova/forms/base_form.py:23 templates/form/collapsable/form.html:62
|
#: konova/forms/base_form.py:23 templates/form/collapsable/form.html:62
|
||||||
msgid "Save"
|
msgid "Save"
|
||||||
msgstr "Speichern"
|
msgstr "Speichern"
|
||||||
|
|
||||||
#: konova/forms/base_form.py:72
|
#: konova/forms/base_form.py:74
|
||||||
msgid "Not editable"
|
msgid "Not editable"
|
||||||
msgstr "Nicht editierbar"
|
msgstr "Nicht editierbar"
|
||||||
|
|
||||||
@@ -1794,15 +1807,11 @@ msgstr "Nicht editierbar"
|
|||||||
msgid "Geometry"
|
msgid "Geometry"
|
||||||
msgstr "Geometrie"
|
msgstr "Geometrie"
|
||||||
|
|
||||||
#: konova/forms/geometry_form.py:100
|
#: konova/forms/geometry_form.py:101
|
||||||
msgid "Only surfaces allowed. Points or lines must be buffered."
|
msgid "Only surfaces allowed. Points or lines must be buffered."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Nur Flächen erlaubt. Punkte oder Linien müssen zu Flächen gepuffert werden."
|
"Nur Flächen erlaubt. Punkte oder Linien müssen zu Flächen gepuffert werden."
|
||||||
|
|
||||||
#: konova/forms/geometry_form.py:153
|
|
||||||
msgid "Geometry must be greater than 1m². Currently is {}m²"
|
|
||||||
msgstr "Geometrie muss größer als 1m² sein. Aktueller Flächeninhalt: {}m²"
|
|
||||||
|
|
||||||
#: konova/forms/modals/document_form.py:37
|
#: konova/forms/modals/document_form.py:37
|
||||||
msgid "When has this file been created? Important for photos."
|
msgid "When has this file been created? Important for photos."
|
||||||
msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?"
|
msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?"
|
||||||
@@ -1841,6 +1850,7 @@ msgstr ""
|
|||||||
"Ich, {} {}, bestätige, dass diese Daten wieder entzeichnet werden müssen."
|
"Ich, {} {}, bestätige, dass diese Daten wieder entzeichnet werden müssen."
|
||||||
|
|
||||||
#: konova/forms/modals/remove_form.py:22 konova/forms/remove_form.py:24
|
#: konova/forms/modals/remove_form.py:22 konova/forms/remove_form.py:24
|
||||||
|
#: user/forms/modals/api_token.py:16
|
||||||
msgid "Confirm"
|
msgid "Confirm"
|
||||||
msgstr "Bestätige"
|
msgstr "Bestätige"
|
||||||
|
|
||||||
@@ -1911,11 +1921,11 @@ msgstr "Kontrolle am"
|
|||||||
msgid "Other"
|
msgid "Other"
|
||||||
msgstr "Sonstige"
|
msgstr "Sonstige"
|
||||||
|
|
||||||
#: konova/sub_settings/django_settings.py:166
|
#: konova/sub_settings/django_settings.py:156
|
||||||
msgid "German"
|
msgid "German"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: konova/sub_settings/django_settings.py:167
|
#: konova/sub_settings/django_settings.py:157
|
||||||
msgid "English"
|
msgid "English"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -2091,10 +2101,6 @@ msgstr ""
|
|||||||
"Eintrag ist verzeichnet. Um Daten zu bearbeiten, muss der Eintrag erst "
|
"Eintrag ist verzeichnet. Um Daten zu bearbeiten, muss der Eintrag erst "
|
||||||
"entzeichnet werden."
|
"entzeichnet werden."
|
||||||
|
|
||||||
#: konova/utils/message_templates.py:25
|
|
||||||
msgid "This data is not shared with you"
|
|
||||||
msgstr "Diese Daten sind für Sie nicht freigegeben"
|
|
||||||
|
|
||||||
#: konova/utils/message_templates.py:26
|
#: konova/utils/message_templates.py:26
|
||||||
msgid ""
|
msgid ""
|
||||||
"Remember: This data has not been shared with you, yet. This means you can "
|
"Remember: This data has not been shared with you, yet. This means you can "
|
||||||
@@ -2253,34 +2259,36 @@ msgstr ""
|
|||||||
"Die Geometrie enthielt mehr als {} Eckpunkte. Sie musste vereinfacht werden "
|
"Die Geometrie enthielt mehr als {} Eckpunkte. Sie musste vereinfacht werden "
|
||||||
"um die Obergrenze von {} erlaubten Eckpunkten einzuhalten."
|
"um die Obergrenze von {} erlaubten Eckpunkten einzuhalten."
|
||||||
|
|
||||||
#: konova/utils/message_templates.py:88
|
#: konova/utils/message_templates.py:86
|
||||||
|
msgid ""
|
||||||
|
"The geometry contained {} parts which have been detected as invalid (e.g. "
|
||||||
|
"too small to be valid). These parts have been removed. Please check the "
|
||||||
|
"stored geometry."
|
||||||
|
msgstr ""
|
||||||
|
"Die Geometrie enthielt {} invalide Bestandteile (z.B. unaussagekräftige "
|
||||||
|
"Kleinstflächen).Diese Bestandteile wurden automatisch entfernt. Bitte "
|
||||||
|
"überprüfen Sie die angepasste Geometrie."
|
||||||
|
|
||||||
|
#: konova/utils/message_templates.py:89
|
||||||
msgid "This intervention has {} revocations"
|
msgid "This intervention has {} revocations"
|
||||||
msgstr "Dem Eingriff liegen {} Widersprüche vor"
|
msgstr "Dem Eingriff liegen {} Widersprüche vor"
|
||||||
|
|
||||||
#: konova/utils/message_templates.py:91
|
#: konova/utils/message_templates.py:92
|
||||||
msgid "Checked on {} by {}"
|
msgid "Checked on {} by {}"
|
||||||
msgstr "Am {} von {} geprüft worden"
|
msgstr "Am {} von {} geprüft worden"
|
||||||
|
|
||||||
#: konova/utils/message_templates.py:92
|
#: konova/utils/message_templates.py:93
|
||||||
msgid "Data has changed since last check on {} by {}"
|
msgid "Data has changed since last check on {} by {}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Daten wurden nach der letzten Prüfung geändert. Letzte Prüfung am {} durch {}"
|
"Daten wurden nach der letzten Prüfung geändert. Letzte Prüfung am {} durch {}"
|
||||||
|
|
||||||
#: konova/utils/message_templates.py:93
|
#: konova/utils/message_templates.py:94
|
||||||
msgid "Current data not checked yet"
|
msgid "Current data not checked yet"
|
||||||
msgstr "Momentane Daten noch nicht geprüft"
|
msgstr "Momentane Daten noch nicht geprüft"
|
||||||
|
|
||||||
#: konova/utils/messenger.py:70
|
#: konova/utils/message_templates.py:97
|
||||||
msgid "{} checked"
|
msgid "New token generated. Administrators need to validate."
|
||||||
msgstr "{} geprüft"
|
msgstr "Neuer Token generiert. Administratoren sind informiert."
|
||||||
|
|
||||||
#: konova/utils/messenger.py:72
|
|
||||||
msgid "<a href=\"{}\">Check it out</a>"
|
|
||||||
msgstr "<a href=\"{}\">Schauen Sie rein</a>"
|
|
||||||
|
|
||||||
#: konova/utils/messenger.py:73
|
|
||||||
msgid "{} has been checked successfully by user {}! {}"
|
|
||||||
msgstr "{} wurde erfolgreich vom Nutzer {} geprüft! {}"
|
|
||||||
|
|
||||||
#: konova/utils/quality.py:32
|
#: konova/utils/quality.py:32
|
||||||
msgid "missing"
|
msgid "missing"
|
||||||
@@ -2300,7 +2308,15 @@ msgstr ""
|
|||||||
"Dieses Datum ist unrealistisch. Geben Sie bitte das korrekte Datum ein "
|
"Dieses Datum ist unrealistisch. Geben Sie bitte das korrekte Datum ein "
|
||||||
"(>1950)."
|
"(>1950)."
|
||||||
|
|
||||||
#: konova/views/home.py:75 templates/navbars/navbar.html:16
|
#: konova/views/base.py:209
|
||||||
|
msgid "{} added"
|
||||||
|
msgstr "{} hinzugefügt"
|
||||||
|
|
||||||
|
#: konova/views/base.py:281
|
||||||
|
msgid "{} edited"
|
||||||
|
msgstr "{} bearbeitet"
|
||||||
|
|
||||||
|
#: konova/views/home.py:72 templates/navbars/navbar.html:16
|
||||||
msgid "Home"
|
msgid "Home"
|
||||||
msgstr "Home"
|
msgstr "Home"
|
||||||
|
|
||||||
@@ -2308,14 +2324,6 @@ msgstr "Home"
|
|||||||
msgid "Log"
|
msgid "Log"
|
||||||
msgstr "Log"
|
msgstr "Log"
|
||||||
|
|
||||||
#: konova/views/map_proxy.py:70
|
|
||||||
msgid ""
|
|
||||||
"The external service is currently unavailable.<br>Please try again in a few "
|
|
||||||
"moments..."
|
|
||||||
msgstr ""
|
|
||||||
"Der externe Dienst ist zur Zeit nicht erreichbar.<br>Versuchen Sie es in ein "
|
|
||||||
"paar Sekunden nochmal."
|
|
||||||
|
|
||||||
#: konova/views/record.py:30
|
#: konova/views/record.py:30
|
||||||
msgid "{} unrecorded"
|
msgid "{} unrecorded"
|
||||||
msgstr "{} entzeichnet"
|
msgstr "{} entzeichnet"
|
||||||
@@ -2328,6 +2336,10 @@ msgstr "{} verzeichnet"
|
|||||||
msgid "Errors found:"
|
msgid "Errors found:"
|
||||||
msgstr "Fehler gefunden:"
|
msgstr "Fehler gefunden:"
|
||||||
|
|
||||||
|
#: konova/views/report.py:21
|
||||||
|
msgid "Report {}"
|
||||||
|
msgstr "Bericht {}"
|
||||||
|
|
||||||
#: konova/views/resubmission.py:39
|
#: konova/views/resubmission.py:39
|
||||||
msgid "Resubmission set"
|
msgid "Resubmission set"
|
||||||
msgstr "Wiedervorlage gesetzt"
|
msgstr "Wiedervorlage gesetzt"
|
||||||
@@ -2372,6 +2384,20 @@ msgstr "Alle"
|
|||||||
msgid "News"
|
msgid "News"
|
||||||
msgstr "Neuigkeiten"
|
msgstr "Neuigkeiten"
|
||||||
|
|
||||||
|
#: templates/400.html:12
|
||||||
|
msgid "Request was invalid"
|
||||||
|
msgstr "Anfrage fehlerhaft"
|
||||||
|
|
||||||
|
#: templates/400.html:17
|
||||||
|
msgid "There seems to be a problem with the link you opened."
|
||||||
|
msgstr "Es scheint ein Problem mit dem Link zu geben, den Sie geöffnet haben."
|
||||||
|
|
||||||
|
#: templates/400.html:18
|
||||||
|
msgid "Make sure the URL is valid (no whitespaces, properly copied, ...)."
|
||||||
|
msgstr ""
|
||||||
|
"Stellen Sie sicher, dass die URL gültig ist (keine Leerzeichen, fehlerfrei "
|
||||||
|
"kopiert, ...)."
|
||||||
|
|
||||||
#: templates/404.html:7
|
#: templates/404.html:7
|
||||||
msgid "Not found"
|
msgid "Not found"
|
||||||
msgstr "Nicht gefunden"
|
msgstr "Nicht gefunden"
|
||||||
@@ -2384,11 +2410,11 @@ msgstr "Die angeforderten Daten existieren nicht."
|
|||||||
msgid "Make sure the URL is valid (no whitespaces, ...)."
|
msgid "Make sure the URL is valid (no whitespaces, ...)."
|
||||||
msgstr "Stellen Sie sicher, dass die URL gültig ist (keine Leerzeichen, ...)."
|
msgstr "Stellen Sie sicher, dass die URL gültig ist (keine Leerzeichen, ...)."
|
||||||
|
|
||||||
#: templates/500.html:7
|
#: templates/500.html:12
|
||||||
msgid "Server Error"
|
msgid "Server Error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: templates/500.html:10
|
#: templates/500.html:17
|
||||||
msgid "Something happened. Admins have been informed. We are working on it!"
|
msgid "Something happened. Admins have been informed. We are working on it!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Irgendetwas ist passiert. Die Administratoren wurden informiert. Wir "
|
"Irgendetwas ist passiert. Die Administratoren wurden informiert. Wir "
|
||||||
@@ -2817,11 +2843,15 @@ msgstr "Mehr"
|
|||||||
msgid "Reports"
|
msgid "Reports"
|
||||||
msgstr "Berichte"
|
msgstr "Berichte"
|
||||||
|
|
||||||
#: templates/navbars/navbar.html:56 user/templates/user/index.html:31
|
#: templates/navbars/navbar.html:57
|
||||||
|
msgid "Admin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: templates/navbars/navbar.html:59 user/templates/user/index.html:31
|
||||||
msgid "Settings"
|
msgid "Settings"
|
||||||
msgstr "Einstellungen"
|
msgstr "Einstellungen"
|
||||||
|
|
||||||
#: templates/navbars/navbar.html:57
|
#: templates/navbars/navbar.html:60
|
||||||
msgid "Logout"
|
msgid "Logout"
|
||||||
msgstr "Abmelden"
|
msgstr "Abmelden"
|
||||||
|
|
||||||
@@ -2854,6 +2884,22 @@ msgstr ""
|
|||||||
"Falls die Geometrie nicht leer ist, werden die Flurstücke aktuell berechnet. "
|
"Falls die Geometrie nicht leer ist, werden die Flurstücke aktuell berechnet. "
|
||||||
"Bitte laden Sie diese Seite in ein paar Augenblicken erneut..."
|
"Bitte laden Sie diese Seite in ein paar Augenblicken erneut..."
|
||||||
|
|
||||||
|
#: user/forms/modals/api_token.py:25
|
||||||
|
msgid "Generate API Token"
|
||||||
|
msgstr "API Token generieren"
|
||||||
|
|
||||||
|
#: user/forms/modals/api_token.py:29
|
||||||
|
msgid ""
|
||||||
|
"You are about to create a new API token. The existing one will not be usable "
|
||||||
|
"afterwards."
|
||||||
|
msgstr ""
|
||||||
|
"Wenn Sie fortfahren, generieren Sie einen neuen API Token. Ihren "
|
||||||
|
"existierenden werden Sie dann nicht länger nutzen können."
|
||||||
|
|
||||||
|
#: user/forms/modals/api_token.py:31
|
||||||
|
msgid "A new token needs to be validated by an administrator!"
|
||||||
|
msgstr "Neue Tokens müssen durch Administratoren freigeschaltet werden!"
|
||||||
|
|
||||||
#: user/forms/modals/team.py:20 user/forms/modals/team.py:24
|
#: user/forms/modals/team.py:20 user/forms/modals/team.py:24
|
||||||
#: user/forms/team.py:17 user/forms/team.py:22
|
#: user/forms/team.py:17 user/forms/team.py:22
|
||||||
msgid "Team name"
|
msgid "Team name"
|
||||||
@@ -2876,11 +2922,11 @@ msgstr ""
|
|||||||
"Mehrfachauswahl möglich - Sie können nur Nutzer wählen, die noch nicht "
|
"Mehrfachauswahl möglich - Sie können nur Nutzer wählen, die noch nicht "
|
||||||
"Mitglieder dieses Teams sind. Geben Sie den ganzen Nutzernamen an."
|
"Mitglieder dieses Teams sind. Geben Sie den ganzen Nutzernamen an."
|
||||||
|
|
||||||
#: user/forms/modals/team.py:56 user/tests/unit/test_forms.py:31
|
#: user/forms/modals/team.py:56 user/tests/unit/test_forms.py:30
|
||||||
msgid "Create new team"
|
msgid "Create new team"
|
||||||
msgstr "Neues Team anlegen"
|
msgstr "Neues Team anlegen"
|
||||||
|
|
||||||
#: user/forms/modals/team.py:57 user/tests/unit/test_forms.py:32
|
#: user/forms/modals/team.py:57 user/tests/unit/test_forms.py:31
|
||||||
msgid ""
|
msgid ""
|
||||||
"You will become the administrator for this group by default. You do not need "
|
"You will become the administrator for this group by default. You do not need "
|
||||||
"to add yourself to the list of members."
|
"to add yourself to the list of members."
|
||||||
@@ -2909,11 +2955,11 @@ msgid "There must be at least one admin on this team."
|
|||||||
msgstr "Es muss mindestens einen Administrator für das Team geben."
|
msgstr "Es muss mindestens einen Administrator für das Team geben."
|
||||||
|
|
||||||
#: user/forms/modals/team.py:160 user/templates/user/team/index.html:60
|
#: user/forms/modals/team.py:160 user/templates/user/team/index.html:60
|
||||||
#: user/tests/unit/test_forms.py:88
|
#: user/tests/unit/test_forms.py:87
|
||||||
msgid "Edit team"
|
msgid "Edit team"
|
||||||
msgstr "Team bearbeiten"
|
msgstr "Team bearbeiten"
|
||||||
|
|
||||||
#: user/forms/modals/team.py:187 user/tests/unit/test_forms.py:165
|
#: user/forms/modals/team.py:187 user/tests/unit/test_forms.py:164
|
||||||
msgid ""
|
msgid ""
|
||||||
"ATTENTION!\n"
|
"ATTENTION!\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -2930,7 +2976,7 @@ msgstr ""
|
|||||||
"Sind Sie sicher, dass Sie dieses Team löschen möchten?"
|
"Sind Sie sicher, dass Sie dieses Team löschen möchten?"
|
||||||
|
|
||||||
#: user/forms/modals/team.py:197 user/templates/user/team/index.html:56
|
#: user/forms/modals/team.py:197 user/templates/user/team/index.html:56
|
||||||
#: user/tests/unit/test_forms.py:198
|
#: user/tests/unit/test_forms.py:197
|
||||||
msgid "Leave team"
|
msgid "Leave team"
|
||||||
msgstr "Team verlassen"
|
msgstr "Team verlassen"
|
||||||
|
|
||||||
@@ -2962,22 +3008,10 @@ msgstr "Benachrichtigungen"
|
|||||||
msgid "Select the situations when you want to receive a notification"
|
msgid "Select the situations when you want to receive a notification"
|
||||||
msgstr "Wann wollen Sie per E-Mail benachrichtigt werden?"
|
msgstr "Wann wollen Sie per E-Mail benachrichtigt werden?"
|
||||||
|
|
||||||
#: user/forms/user.py:38 user/tests/unit/test_forms.py:234
|
#: user/forms/user.py:38 user/tests/unit/test_forms.py:233
|
||||||
msgid "Edit notifications"
|
msgid "Edit notifications"
|
||||||
msgstr "Benachrichtigungen bearbeiten"
|
msgstr "Benachrichtigungen bearbeiten"
|
||||||
|
|
||||||
#: user/forms/user.py:73
|
|
||||||
msgid "Token"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: user/forms/user.py:88 user/tests/unit/test_forms.py:260
|
|
||||||
msgid "Create new token"
|
|
||||||
msgstr "Neuen Token generieren"
|
|
||||||
|
|
||||||
#: user/forms/user.py:89 user/tests/unit/test_forms.py:261
|
|
||||||
msgid "A new token needs to be validated by an administrator!"
|
|
||||||
msgstr "Neue Tokens müssen durch Administratoren freigeschaltet werden!"
|
|
||||||
|
|
||||||
#: user/models/user_action.py:23
|
#: user/models/user_action.py:23
|
||||||
msgid "Unrecorded"
|
msgid "Unrecorded"
|
||||||
msgstr "Entzeichnet"
|
msgstr "Entzeichnet"
|
||||||
@@ -3032,7 +3066,7 @@ msgid "Manage teams"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: user/templates/user/index.html:53 user/templates/user/team/index.html:19
|
#: user/templates/user/index.html:53 user/templates/user/team/index.html:19
|
||||||
#: user/views.py:171
|
#: user/views/views.py:134
|
||||||
msgid "Teams"
|
msgid "Teams"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -3068,270 +3102,64 @@ msgstr "API Einstellungen"
|
|||||||
msgid "Current token"
|
msgid "Current token"
|
||||||
msgstr "Aktueller Token"
|
msgstr "Aktueller Token"
|
||||||
|
|
||||||
#: user/templates/user/token.html:14
|
#: user/templates/user/token.html:15
|
||||||
|
msgid "Create new token"
|
||||||
|
msgstr "Neuen Token generieren"
|
||||||
|
|
||||||
|
#: user/templates/user/token.html:23
|
||||||
msgid "Authenticated by admins"
|
msgid "Authenticated by admins"
|
||||||
msgstr "Von Admin freigeschaltet"
|
msgstr "Von Admin freigeschaltet"
|
||||||
|
|
||||||
#: user/templates/user/token.html:18
|
#: user/templates/user/token.html:27
|
||||||
msgid "Token has been verified and can be used"
|
msgid "Token has been verified and can be used"
|
||||||
msgstr "Token wurde freigeschaltet und kann verwendet werden"
|
msgstr "Token wurde freigeschaltet und kann verwendet werden"
|
||||||
|
|
||||||
#: user/templates/user/token.html:20
|
#: user/templates/user/token.html:29
|
||||||
msgid "Token waiting for verification"
|
msgid "Token waiting for verification"
|
||||||
msgstr "Token noch nicht freigeschaltet"
|
msgstr "Token noch nicht freigeschaltet"
|
||||||
|
|
||||||
#: user/templates/user/token.html:24
|
#: user/templates/user/token.html:33
|
||||||
msgid "Valid until"
|
msgid "Valid until"
|
||||||
msgstr "Läuft ab am"
|
msgstr "Läuft ab am"
|
||||||
|
|
||||||
#: user/views.py:35
|
#: user/views/api_token.py:34
|
||||||
msgid "User settings"
|
|
||||||
msgstr "Einstellungen"
|
|
||||||
|
|
||||||
#: user/views.py:61
|
|
||||||
msgid "Notifications edited"
|
|
||||||
msgstr "Benachrichtigungen bearbeitet"
|
|
||||||
|
|
||||||
#: user/views.py:73
|
|
||||||
msgid "User notifications"
|
|
||||||
msgstr "Benachrichtigungen"
|
|
||||||
|
|
||||||
#: user/views.py:96
|
|
||||||
msgid "New token generated. Administrators need to validate."
|
|
||||||
msgstr "Neuer Token generiert. Administratoren sind informiert."
|
|
||||||
|
|
||||||
#: user/views.py:107
|
|
||||||
msgid "User API token"
|
msgid "User API token"
|
||||||
msgstr "API Nutzer Token"
|
msgstr "API Nutzer Token"
|
||||||
|
|
||||||
#: user/views.py:183
|
#: user/views/views.py:31
|
||||||
|
msgid "User settings"
|
||||||
|
msgstr "Einstellungen"
|
||||||
|
|
||||||
|
#: user/views/views.py:44
|
||||||
|
msgid "User notifications"
|
||||||
|
msgstr "Benachrichtigungen"
|
||||||
|
|
||||||
|
#: user/views/views.py:64
|
||||||
|
msgid "Notifications edited"
|
||||||
|
msgstr "Benachrichtigungen bearbeitet"
|
||||||
|
|
||||||
|
#: user/views/views.py:152
|
||||||
msgid "New team added"
|
msgid "New team added"
|
||||||
msgstr "Neues Team hinzugefügt"
|
msgstr "Neues Team hinzugefügt"
|
||||||
|
|
||||||
#: user/views.py:198
|
#: user/views/views.py:167
|
||||||
msgid "Team edited"
|
msgid "Team edited"
|
||||||
msgstr "Team bearbeitet"
|
msgstr "Team bearbeitet"
|
||||||
|
|
||||||
#: user/views.py:213
|
#: user/views/views.py:182
|
||||||
msgid "Team removed"
|
msgid "Team removed"
|
||||||
msgstr "Team gelöscht"
|
msgstr "Team gelöscht"
|
||||||
|
|
||||||
#: user/views.py:228
|
#: user/views/views.py:197
|
||||||
msgid "You are not a member of this team"
|
msgid "You are not a member of this team"
|
||||||
msgstr "Sie sind kein Mitglied dieses Teams"
|
msgstr "Sie sind kein Mitglied dieses Teams"
|
||||||
|
|
||||||
#: user/views.py:235
|
#: user/views/views.py:204
|
||||||
msgid "Left Team"
|
msgid "Left Team"
|
||||||
msgstr "Team verlassen"
|
msgstr "Team verlassen"
|
||||||
|
|
||||||
#~ msgid "close"
|
#~ msgid "EMA {} added"
|
||||||
#~ msgstr "Schließen"
|
#~ msgstr "EMA {} hinzugefügt"
|
||||||
|
|
||||||
#~ msgid "Options"
|
#~ msgid "EMA {} edited"
|
||||||
#~ msgstr "Optionen"
|
#~ msgstr "EMA {} bearbeitet"
|
||||||
|
|
||||||
#~ msgid "Commands"
|
|
||||||
#~ msgstr "Befehle"
|
|
||||||
|
|
||||||
#~ msgid "Missing command."
|
|
||||||
#~ msgstr "Befehl fehlt"
|
|
||||||
|
|
||||||
#~ msgid "Missing argument"
|
|
||||||
#~ msgstr "Argument fehlt"
|
|
||||||
|
|
||||||
#~ msgid "Missing option"
|
|
||||||
#~ msgstr "Option fehlt"
|
|
||||||
|
|
||||||
#~ msgid "Missing parameter"
|
|
||||||
#~ msgstr "Parameter fehlt"
|
|
||||||
|
|
||||||
#~ msgid "Messages"
|
|
||||||
#~ msgstr "Nachrichten"
|
|
||||||
|
|
||||||
#~ msgid "This field is required."
|
|
||||||
#~ msgstr "Pflichtfeld"
|
|
||||||
|
|
||||||
#~ msgid "Monday"
|
|
||||||
#~ msgstr "Montag"
|
|
||||||
|
|
||||||
#~ msgid "Tuesday"
|
|
||||||
#~ msgstr "Dienstag"
|
|
||||||
|
|
||||||
#~ msgid "Wednesday"
|
|
||||||
#~ msgstr "Mittwoch"
|
|
||||||
|
|
||||||
#~ msgid "Thursday"
|
|
||||||
#~ msgstr "Donnerstag"
|
|
||||||
|
|
||||||
#~ msgid "Friday"
|
|
||||||
#~ msgstr "Freitag"
|
|
||||||
|
|
||||||
#~ msgid "Saturday"
|
|
||||||
#~ msgstr "Samstag"
|
|
||||||
|
|
||||||
#~ msgid "Sunday"
|
|
||||||
#~ msgstr "Sonntag"
|
|
||||||
|
|
||||||
#~ msgid "Mon"
|
|
||||||
#~ msgstr "Mo"
|
|
||||||
|
|
||||||
#~ msgid "Tue"
|
|
||||||
#~ msgstr "Di"
|
|
||||||
|
|
||||||
#~ msgid "Wed"
|
|
||||||
#~ msgstr "Mi"
|
|
||||||
|
|
||||||
#~ msgid "Thu"
|
|
||||||
#~ msgstr "Do"
|
|
||||||
|
|
||||||
#~ msgid "Fri"
|
|
||||||
#~ msgstr "Fr"
|
|
||||||
|
|
||||||
#~ msgid "Sat"
|
|
||||||
#~ msgstr "Sa"
|
|
||||||
|
|
||||||
#~ msgid "Sun"
|
|
||||||
#~ msgstr "So"
|
|
||||||
|
|
||||||
#~ msgid "January"
|
|
||||||
#~ msgstr "Januar"
|
|
||||||
|
|
||||||
#~ msgid "February"
|
|
||||||
#~ msgstr "Februar"
|
|
||||||
|
|
||||||
#~ msgid "March"
|
|
||||||
#~ msgstr "März"
|
|
||||||
|
|
||||||
#~ msgid "May"
|
|
||||||
#~ msgstr "Mai"
|
|
||||||
|
|
||||||
#~ msgid "June"
|
|
||||||
#~ msgstr "Juni"
|
|
||||||
|
|
||||||
#~ msgid "July"
|
|
||||||
#~ msgstr "Juli"
|
|
||||||
|
|
||||||
#~ msgid "October"
|
|
||||||
#~ msgstr "Oktober"
|
|
||||||
|
|
||||||
#~ msgid "December"
|
|
||||||
#~ msgstr "Dezember"
|
|
||||||
|
|
||||||
#~ msgid "mar"
|
|
||||||
#~ msgstr "mär"
|
|
||||||
|
|
||||||
#~ msgid "may"
|
|
||||||
#~ msgstr "mai"
|
|
||||||
|
|
||||||
#~ msgid "oct"
|
|
||||||
#~ msgstr "okt"
|
|
||||||
|
|
||||||
#~ msgid "dec"
|
|
||||||
#~ msgstr "dez"
|
|
||||||
|
|
||||||
#~ msgctxt "abbrev. month"
|
|
||||||
#~ msgid "March"
|
|
||||||
#~ msgstr "Mär"
|
|
||||||
|
|
||||||
#~ msgctxt "abbrev. month"
|
|
||||||
#~ msgid "May"
|
|
||||||
#~ msgstr "Mai"
|
|
||||||
|
|
||||||
#~ msgctxt "abbrev. month"
|
|
||||||
#~ msgid "June"
|
|
||||||
#~ msgstr "Juni"
|
|
||||||
|
|
||||||
#~ msgctxt "abbrev. month"
|
|
||||||
#~ msgid "July"
|
|
||||||
#~ msgstr "Juli"
|
|
||||||
|
|
||||||
#~ msgctxt "abbrev. month"
|
|
||||||
#~ msgid "Oct."
|
|
||||||
#~ msgstr "Okt."
|
|
||||||
|
|
||||||
#~ msgctxt "abbrev. month"
|
|
||||||
#~ msgid "Dec."
|
|
||||||
#~ msgstr "Dez."
|
|
||||||
|
|
||||||
#~ msgctxt "alt. month"
|
|
||||||
#~ msgid "January"
|
|
||||||
#~ msgstr "Januar"
|
|
||||||
|
|
||||||
#~ msgctxt "alt. month"
|
|
||||||
#~ msgid "February"
|
|
||||||
#~ msgstr "Februar"
|
|
||||||
|
|
||||||
#~ msgctxt "alt. month"
|
|
||||||
#~ msgid "March"
|
|
||||||
#~ msgstr "März"
|
|
||||||
|
|
||||||
#~ msgctxt "alt. month"
|
|
||||||
#~ msgid "May"
|
|
||||||
#~ msgstr "Mai"
|
|
||||||
|
|
||||||
#~ msgctxt "alt. month"
|
|
||||||
#~ msgid "June"
|
|
||||||
#~ msgstr "Juni"
|
|
||||||
|
|
||||||
#~ msgctxt "alt. month"
|
|
||||||
#~ msgid "July"
|
|
||||||
#~ msgstr "Juli"
|
|
||||||
|
|
||||||
#~ msgctxt "alt. month"
|
|
||||||
#~ msgid "October"
|
|
||||||
#~ msgstr "Oktober"
|
|
||||||
|
|
||||||
#~ msgctxt "alt. month"
|
|
||||||
#~ msgid "December"
|
|
||||||
#~ msgstr "Dezember"
|
|
||||||
|
|
||||||
#~ msgid "or"
|
|
||||||
#~ msgstr "oder"
|
|
||||||
|
|
||||||
#~ msgid ""
|
|
||||||
#~ "Deductable surface can not be larger than existing surfaces in after "
|
|
||||||
#~ "states"
|
|
||||||
#~ msgstr ""
|
|
||||||
#~ "Die abbuchbare Fläche darf die Gesamtfläche der Zielzustände nicht "
|
|
||||||
#~ "überschreiten"
|
|
||||||
|
|
||||||
#~ msgid ""
|
|
||||||
#~ "Deductable surface can not be smaller than the sum of already existing "
|
|
||||||
#~ "deductions. Please contact the responsible users for the deductions!"
|
|
||||||
#~ msgstr ""
|
|
||||||
#~ "Es wurde bereits mehr Fläche abgebucht, als Sie nun als abbuchbar "
|
|
||||||
#~ "einstellen wollen. Kontaktieren Sie die für die Abbuchungen "
|
|
||||||
#~ "verantwortlichen Nutzer!"
|
|
||||||
|
|
||||||
#~ msgid "Added deadline"
|
|
||||||
#~ msgstr "Frist/Termin hinzugefügt"
|
|
||||||
|
|
||||||
#~ msgid "Change default configuration for your KSP map"
|
|
||||||
#~ msgstr "Karteneinstellungen ändern"
|
|
||||||
|
|
||||||
#~ msgid "Map settings"
|
|
||||||
#~ msgstr "Karte"
|
|
||||||
|
|
||||||
#~ msgid "There are errors on this intervention:"
|
|
||||||
#~ msgstr "Es liegen Fehler in diesem Eingriff vor:"
|
|
||||||
|
|
||||||
#~ msgid "Before"
|
|
||||||
#~ msgstr "Vor"
|
|
||||||
|
|
||||||
#~ msgid "Groups"
|
|
||||||
#~ msgstr "Gruppen"
|
|
||||||
|
|
||||||
#~ msgid "Show more..."
|
|
||||||
#~ msgstr "Mehr anzeigen..."
|
|
||||||
|
|
||||||
#~ msgid "Kreis"
|
|
||||||
#~ msgstr "Kreis"
|
|
||||||
|
|
||||||
#~ msgid "Gemarkung"
|
|
||||||
#~ msgstr "Gemarkung"
|
|
||||||
|
|
||||||
#~ msgid "Loading..."
|
|
||||||
#~ msgstr "Lade..."
|
|
||||||
|
|
||||||
#~ msgid "Who handles the eco-account"
|
|
||||||
#~ msgstr "Wer für die Herrichtung des Ökokontos verantwortlich ist"
|
|
||||||
|
|||||||
@@ -1,52 +1,50 @@
|
|||||||
amqp==5.2.0
|
amqp==5.3.1
|
||||||
asgiref==3.8.1
|
asgiref==3.8.1
|
||||||
async-timeout==4.0.3
|
async-timeout==5.0.1
|
||||||
beautifulsoup4==4.13.0b2
|
beautifulsoup4==4.13.0b2
|
||||||
billiard==4.2.0
|
billiard==4.2.1
|
||||||
cached-property==1.5.2
|
cached-property==2.0.1
|
||||||
celery==5.4.0
|
celery==5.4.0
|
||||||
certifi==2024.7.4
|
certifi==2024.12.14
|
||||||
cffi==1.17.0
|
cffi==1.17.1
|
||||||
chardet==5.2.0
|
chardet==5.2.0
|
||||||
charset-normalizer==3.3.2
|
charset-normalizer==3.4.0
|
||||||
click==8.1.7
|
click==8.1.8
|
||||||
click-didyoumean==0.3.1
|
click-didyoumean==0.3.1
|
||||||
click-plugins==1.1.1
|
click-plugins==1.1.1
|
||||||
click-repl==0.3.0
|
click-repl==0.3.0
|
||||||
coverage==7.5.4
|
coverage==7.6.9
|
||||||
cryptography==43.0.0
|
cryptography==44.0.0
|
||||||
Deprecated==1.2.14
|
Deprecated==1.2.15
|
||||||
Django==5.0.8
|
Django==5.1.4
|
||||||
django-autocomplete-light==3.11.0
|
django-autocomplete-light==3.11.0
|
||||||
django-bootstrap-modal-forms==3.0.4
|
django-bootstrap-modal-forms==3.0.5
|
||||||
django-bootstrap4==24.3
|
django-bootstrap4==24.4
|
||||||
django-environ==0.11.2
|
django-environ==0.11.2
|
||||||
django-filter==24.3
|
django-filter==24.3
|
||||||
django-fontawesome-5==1.0.18
|
django-fontawesome-5==1.0.18
|
||||||
django-oauth-toolkit==2.4.0
|
django-oauth-toolkit==3.0.1
|
||||||
django-simple-sso==1.2.0
|
django-tables2==2.7.1
|
||||||
django-tables2==2.7.0
|
et_xmlfile==2.0.0
|
||||||
et-xmlfile==1.1.0
|
gunicorn==23.0.0
|
||||||
gunicorn==22.0.0
|
idna==3.10
|
||||||
idna==3.7
|
importlib_metadata==8.5.0
|
||||||
importlib_metadata==8.2.0
|
|
||||||
itsdangerous==0.24
|
|
||||||
jwcrypto==1.5.6
|
jwcrypto==1.5.6
|
||||||
kombu==5.4.0rc1
|
kombu==5.4.0rc1
|
||||||
oauthlib==3.2.2
|
oauthlib==3.2.2
|
||||||
openpyxl==3.2.0b1
|
openpyxl==3.2.0b1
|
||||||
packaging==24.1
|
packaging==24.2
|
||||||
pika==1.3.2
|
pika==1.3.2
|
||||||
pillow==10.4.0
|
pillow==11.0.0
|
||||||
prompt_toolkit==3.0.47
|
prompt_toolkit==3.0.48
|
||||||
psycopg==3.2.1
|
psycopg==3.2.3
|
||||||
psycopg-binary==3.2.1
|
psycopg-binary==3.2.3
|
||||||
pycparser==2.22
|
pycparser==2.22
|
||||||
pyparsing==3.1.2
|
pyparsing==3.2.0
|
||||||
pypng==0.20220715.0
|
pypng==0.20220715.0
|
||||||
pyproj==3.6.1
|
pyproj==3.7.0
|
||||||
python-dateutil==2.9.0.post0
|
python-dateutil==2.9.0.post0
|
||||||
pytz==2024.1
|
pytz==2024.2
|
||||||
PyYAML==6.0.2
|
PyYAML==6.0.2
|
||||||
qrcode==7.3.1
|
qrcode==7.3.1
|
||||||
redis==5.1.0b6
|
redis==5.1.0b6
|
||||||
@@ -55,11 +53,11 @@ six==1.16.0
|
|||||||
soupsieve==2.5
|
soupsieve==2.5
|
||||||
sqlparse==0.5.1
|
sqlparse==0.5.1
|
||||||
typing_extensions==4.12.2
|
typing_extensions==4.12.2
|
||||||
tzdata==2024.1
|
tzdata==2024.2
|
||||||
urllib3==2.2.2
|
urllib3==2.3.0
|
||||||
vine==5.1.0
|
vine==5.1.0
|
||||||
wcwidth==0.2.13
|
wcwidth==0.2.13
|
||||||
webservices==0.7
|
webservices==0.7
|
||||||
wrapt==1.16.0
|
wrapt==1.16.0
|
||||||
xmltodict==0.13.0
|
xmltodict==0.14.2
|
||||||
zipp==3.19.2
|
zipp==3.21.0
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user