diff --git a/compensation/templates/compensation/detail/compensation/view.html b/compensation/templates/compensation/detail/compensation/view.html
index 80b5c0f0..8e1b1267 100644
--- a/compensation/templates/compensation/detail/compensation/view.html
+++ b/compensation/templates/compensation/detail/compensation/view.html
@@ -122,7 +122,7 @@
{% include 'map/geom_form.html' %}
- {% include 'konova/includes/parcels.html' %}
+ {% include 'konova/includes/parcels/parcels.html' %}
{% include 'konova/includes/comment_card.html' %}
diff --git a/compensation/templates/compensation/detail/eco_account/view.html b/compensation/templates/compensation/detail/eco_account/view.html
index 116b6670..0eb354fe 100644
--- a/compensation/templates/compensation/detail/eco_account/view.html
+++ b/compensation/templates/compensation/detail/eco_account/view.html
@@ -104,7 +104,7 @@
{% include 'map/geom_form.html' %}
- {% include 'konova/includes/parcels.html' %}
+ {% include 'konova/includes/parcels/parcels.html' %}
{% include 'konova/includes/comment_card.html' %}
diff --git a/compensation/templates/compensation/report/compensation/report.html b/compensation/templates/compensation/report/compensation/report.html
index 66205739..7088ff07 100644
--- a/compensation/templates/compensation/report/compensation/report.html
+++ b/compensation/templates/compensation/report/compensation/report.html
@@ -38,7 +38,7 @@
{% include 'map/geom_form.html' %}
- {% include 'konova/includes/parcels.html' %}
+ {% include 'konova/includes/parcels/parcels.html' %}
{% include 'konova/includes/report/qrcodes.html' %}
diff --git a/compensation/templates/compensation/report/eco_account/report.html b/compensation/templates/compensation/report/eco_account/report.html
index 823a30fb..a3632ee2 100644
--- a/compensation/templates/compensation/report/eco_account/report.html
+++ b/compensation/templates/compensation/report/eco_account/report.html
@@ -51,7 +51,7 @@
{% include 'map/geom_form.html' %}
- {% include 'konova/includes/parcels.html' %}
+ {% include 'konova/includes/parcels/parcels.html' %}
{% include 'konova/includes/report/qrcodes.html' %}
diff --git a/ema/templates/ema/detail/view.html b/ema/templates/ema/detail/view.html
index 020b7d4b..31d26e0b 100644
--- a/ema/templates/ema/detail/view.html
+++ b/ema/templates/ema/detail/view.html
@@ -90,7 +90,7 @@
{% include 'map/geom_form.html' %}
- {% include 'konova/includes/parcels.html' %}
+ {% include 'konova/includes/parcels/parcels.html' %}
{% include 'konova/includes/comment_card.html' %}
diff --git a/ema/templates/ema/report/report.html b/ema/templates/ema/report/report.html
index 40b11084..43b64865 100644
--- a/ema/templates/ema/report/report.html
+++ b/ema/templates/ema/report/report.html
@@ -38,7 +38,7 @@
{% include 'map/geom_form.html' %}
- {% include 'konova/includes/parcels.html' %}
+ {% include 'konova/includes/parcels/parcels.html' %}
{% include 'konova/includes/report/qrcodes.html' %}
diff --git a/intervention/templates/intervention/detail/view.html b/intervention/templates/intervention/detail/view.html
index c5f9b9c1..2d9628cd 100644
--- a/intervention/templates/intervention/detail/view.html
+++ b/intervention/templates/intervention/detail/view.html
@@ -137,7 +137,7 @@
{% include 'map/geom_form.html' %}
- {% include 'konova/includes/parcels.html' %}
+ {% include 'konova/includes/parcels/parcels.html' %}
{% include 'konova/includes/comment_card.html' %}
diff --git a/intervention/templates/intervention/report/report.html b/intervention/templates/intervention/report/report.html
index e6f13c35..6e238fa2 100644
--- a/intervention/templates/intervention/report/report.html
+++ b/intervention/templates/intervention/report/report.html
@@ -97,7 +97,7 @@
{% include 'map/geom_form.html' %}
- {% include 'konova/includes/parcels.html' %}
+ {% include 'konova/includes/parcels/parcels.html' %}
{% include 'konova/includes/report/qrcodes.html' %}
diff --git a/konova/templates/konova/includes/parcels/parcel_table_content.html b/konova/templates/konova/includes/parcels/parcel_table_content.html
new file mode 100644
index 00000000..0cb5ce11
--- /dev/null
+++ b/konova/templates/konova/includes/parcels/parcel_table_content.html
@@ -0,0 +1,22 @@
+{% load l10n i18n %}
+{% for parcel in parcels %}
+
+ {{parcel.parcel_group.name|default_if_none:"-"}}
+ {{parcel.parcel_group.key|default_if_none:"-"}}
+ {{parcel.flr|default_if_none:"-"|unlocalize}}
+ {{parcel.flrstck_zhlr|default_if_none:"-"|unlocalize}}
+ {{parcel.flrstck_nnr|default_if_none:"-"|unlocalize}}
+
+{% endfor %}
+{% if next_page %}
+
+
+
+ {% trans 'Show more...' %}
+
+
+
+{% endif %}
\ No newline at end of file
diff --git a/konova/templates/konova/includes/parcel_table.html b/konova/templates/konova/includes/parcels/parcel_table_frame.html
similarity index 75%
rename from konova/templates/konova/includes/parcel_table.html
rename to konova/templates/konova/includes/parcels/parcel_table_frame.html
index 76503572..4b4a760d 100644
--- a/konova/templates/konova/includes/parcel_table.html
+++ b/konova/templates/konova/includes/parcels/parcel_table_frame.html
@@ -36,17 +36,8 @@
{% trans 'Parcel number' %}
-
- {% for parcel in parcels %}
-
- {{parcel.parcel_group.name|default_if_none:"-"}}
- {{parcel.parcel_group.key|default_if_none:"-"}}
- {{parcel.flr|default_if_none:"-"|unlocalize}}
- {{parcel.flrstck_zhlr|default_if_none:"-"|unlocalize}}
- {{parcel.flrstck_nnr|default_if_none:"-"|unlocalize}}
-
- {% endfor %}
-
+
+ {% include 'konova/includes/parcels/parcel_table_content.html' %}
{% endif %}
diff --git a/konova/templates/konova/includes/parcels.html b/konova/templates/konova/includes/parcels/parcels.html
similarity index 100%
rename from konova/templates/konova/includes/parcels.html
rename to konova/templates/konova/includes/parcels/parcels.html
diff --git a/konova/urls.py b/konova/urls.py
index d2458f50..00386a11 100644
--- a/konova/urls.py
+++ b/konova/urls.py
@@ -24,7 +24,7 @@ from konova.autocompletes import EcoAccountAutocomplete, \
ShareTeamAutocomplete, HandlerCodeAutocomplete
from konova.settings import SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY, DEBUG
from konova.sso.sso import KonovaSSOClient
-from konova.views import logout_view, home_view, get_geom_parcels
+from konova.views import logout_view, home_view, get_geom_parcels, get_geom_parcels_content
sso_client = KonovaSSOClient(SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY)
urlpatterns = [
@@ -40,7 +40,8 @@ urlpatterns = [
path('cl/', include("codelist.urls")),
path('analysis/', include("analysis.urls")),
path('api/', include("api.urls")),
- path('geom//parcels', get_geom_parcels, name="geometry-parcels"),
+ path('geom//parcels/', get_geom_parcels, name="geometry-parcels"),
+ path('geom//parcels/', get_geom_parcels_content, name="geometry-parcels-content"),
# Autocomplete paths for all apps
path("atcmplt/eco-accounts", EcoAccountAutocomplete.as_view(), name="accounts-autocomplete"),
diff --git a/konova/views.py b/konova/views.py
index 2fd5ff91..db830750 100644
--- a/konova/views.py
+++ b/konova/views.py
@@ -115,7 +115,7 @@ def get_geom_parcels(request: HttpRequest, id: str):
# HTTP code 286 states that the HTMX should stop polling for updates
# https://htmx.org/docs/#polling
status_code = 286
- template = "konova/includes/parcel_table.html"
+ template = "konova/includes/parcels/parcel_table_frame.html"
geom = get_object_or_404(Geometry, id=id)
parcels = geom.get_underlying_parcels()
geos_geom = geom.geom
@@ -133,9 +133,18 @@ def get_geom_parcels(request: HttpRequest, id: str):
parcels = parcels.order_by("-municipal", "flr", "flrstck_zhlr", "flrstck_nnr")
municipals = parcels.order_by("municipal").distinct("municipal").values("municipal__id")
municipals = Municipal.objects.filter(id__in=municipals)
+
+ rpp = 50
+ parcels = parcels[:rpp]
+ next_page = 1
+ if len(parcels) < rpp:
+ next_page = None
+
context = {
"parcels": parcels,
"municipals": municipals,
+ "geom_id": str(id),
+ "next_page": next_page,
}
html = render_to_string(template, context, request)
return HttpResponse(html, status=status_code)
@@ -143,6 +152,36 @@ def get_geom_parcels(request: HttpRequest, id: str):
return HttpResponse(None, status=404)
+@login_required
+def get_geom_parcels_content(request:HttpRequest, id: str, page: int):
+ if page < 0:
+ raise AssertionError("Parcel page can not be negative")
+
+ # HTTP code 286 states that the HTMX should stop polling for updates
+ # https://htmx.org/docs/#polling
+ status_code = 286
+ template = "konova/includes/parcels/parcel_table_content.html"
+ geom = get_object_or_404(Geometry, id=id)
+ parcels = geom.get_underlying_parcels()
+
+ parcels = parcels.order_by("-municipal", "flr", "flrstck_zhlr", "flrstck_nnr")
+ rpp = 50
+ from_p = rpp * (page-1)
+ to_p = rpp * (page)
+ next_page = page + 1
+ parcels = parcels[from_p:to_p]
+ if len(parcels) < rpp:
+ next_page = None
+
+ context = {
+ "parcels": parcels,
+ "geom_id": str(id),
+ "next_page": next_page,
+ }
+ html = render_to_string(template, context, request)
+ return HttpResponse(html, status=status_code)
+
+
def get_404_view(request: HttpRequest, exception=None):
""" Returns a 404 handling view
diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo
index 9626e763..45575064 100644
Binary files a/locale/de/LC_MESSAGES/django.mo and b/locale/de/LC_MESSAGES/django.mo differ
diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po
index 2a78deb7..35ee2c5c 100644
--- a/locale/de/LC_MESSAGES/django.po
+++ b/locale/de/LC_MESSAGES/django.po
@@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-04-19 13:28+0200\n"
+"POT-Creation-Date: 2022-04-21 14:16+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -1582,7 +1582,7 @@ msgid "Search for file number"
msgstr "Nach Aktenzeichen suchen"
#: konova/filters/mixins.py:85
-#: konova/templates/konova/includes/parcel_table.html:13
+#: konova/templates/konova/includes/parcels/parcel_table_frame.html:13
msgid "District"
msgstr "Kreis"
@@ -1595,7 +1595,7 @@ msgid "Search for parcel gmrkng"
msgstr "Nach Gemarkung suchen"
#: konova/filters/mixins.py:111
-#: konova/templates/konova/includes/parcel_table.html:34
+#: konova/templates/konova/includes/parcels/parcel_table_frame.html:34
msgid "Parcel"
msgstr "Flur"
@@ -1604,7 +1604,7 @@ msgid "Search for parcel"
msgstr "Nach Flur suchen"
#: konova/filters/mixins.py:124
-#: konova/templates/konova/includes/parcel_table.html:35
+#: konova/templates/konova/includes/parcels/parcel_table_frame.html:35
msgid "Parcel counter"
msgstr "Flurstückzähler"
@@ -1613,7 +1613,7 @@ msgid "Search for parcel counter"
msgstr "Nach Flurstückzähler suchen"
#: konova/filters/mixins.py:138
-#: konova/templates/konova/includes/parcel_table.html:36
+#: konova/templates/konova/includes/parcels/parcel_table_frame.html:36
msgid "Parcel number"
msgstr "Flurstücknenner"
@@ -1748,33 +1748,37 @@ msgstr ""
msgid "English"
msgstr ""
-#: konova/templates/konova/includes/parcel_table.html:5
+#: konova/templates/konova/includes/parcels/parcel_table_content.html:18
+msgid "Show more..."
+msgstr "Mehr anzeigen..."
+
+#: konova/templates/konova/includes/parcels/parcel_table_frame.html:5
msgid "Parcels can not be calculated, since no geometry is given."
msgstr ""
"Flurstücke können nicht berechnet werden, da keine Geometrie eingegeben "
"wurde."
-#: konova/templates/konova/includes/parcel_table.html:11
+#: konova/templates/konova/includes/parcels/parcel_table_frame.html:11
msgid "Municipal"
msgstr "Gemeinde"
-#: konova/templates/konova/includes/parcel_table.html:12
+#: konova/templates/konova/includes/parcels/parcel_table_frame.html:12
msgid "Municipal key"
msgstr "Gemeindeschlüssel"
-#: konova/templates/konova/includes/parcel_table.html:14
+#: konova/templates/konova/includes/parcels/parcel_table_frame.html:14
msgid "District key"
msgstr "Kreisschlüssel"
-#: konova/templates/konova/includes/parcel_table.html:32
+#: konova/templates/konova/includes/parcels/parcel_table_frame.html:32
msgid "Parcel group"
msgstr "Gemarkung"
-#: konova/templates/konova/includes/parcel_table.html:33
+#: konova/templates/konova/includes/parcels/parcel_table_frame.html:33
msgid "Parcel group key"
msgstr "Gemarkungsschlüssel"
-#: konova/templates/konova/includes/parcels.html:7
+#: konova/templates/konova/includes/parcels/parcels.html:7
msgid "Spatial reference"
msgstr "Raumreferenz"