diff --git a/konova/templates/konova/includes/parcels/parcel_table_content.html b/konova/templates/konova/includes/parcels/parcel_table_content.html index 0cb5ce11..549a8092 100644 --- a/konova/templates/konova/includes/parcels/parcel_table_content.html +++ b/konova/templates/konova/includes/parcels/parcel_table_content.html @@ -1,22 +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 %} - - - - - -{% endif %} \ No newline at end of file + {% if forloop.last and next_page %} + + {{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}} + + {% else %} + + {{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}} + + {% endif %} +{% endfor %} \ No newline at end of file diff --git a/konova/templates/konova/includes/parcels/parcel_table_frame.html b/konova/templates/konova/includes/parcels/parcel_table_frame.html index 4b4a760d..e3292004 100644 --- a/konova/templates/konova/includes/parcels/parcel_table_frame.html +++ b/konova/templates/konova/includes/parcels/parcel_table_frame.html @@ -36,7 +36,7 @@ {% trans 'Parcel number' %} - + {% include 'konova/includes/parcels/parcel_table_content.html' %} diff --git a/konova/views.py b/konova/views.py index db830750..97cb7d82 100644 --- a/konova/views.py +++ b/konova/views.py @@ -110,7 +110,7 @@ def get_geom_parcels(request: HttpRequest, id: str): id (str): The geometry's id Returns: - + A rendered piece of HTML """ # HTTP code 286 states that the HTMX should stop polling for updates # https://htmx.org/docs/#polling @@ -134,7 +134,7 @@ def get_geom_parcels(request: HttpRequest, id: str): municipals = parcels.order_by("municipal").distinct("municipal").values("municipal__id") municipals = Municipal.objects.filter(id__in=municipals) - rpp = 50 + rpp = 100 parcels = parcels[:rpp] next_page = 1 if len(parcels) < rpp: @@ -153,7 +153,20 @@ def get_geom_parcels(request: HttpRequest, id: str): @login_required -def get_geom_parcels_content(request:HttpRequest, id: str, page: int): +def get_geom_parcels_content(request: HttpRequest, id: str, page: int): + """ Getter for infinite scroll of HTMX + + Returns parcels of a specific page/slice of the found parcel set. + Implementation of infinite scroll htmx example: https://htmx.org/examples/infinite-scroll/ + + Args: + request (HttpRequest): The incoming request + id (str): The geometry's id + page (int): The requested page number + + Returns: + A rendered piece of HTML + """ if page < 0: raise AssertionError("Parcel page can not be negative") @@ -165,7 +178,7 @@ def get_geom_parcels_content(request:HttpRequest, id: str, page: int): parcels = geom.get_underlying_parcels() parcels = parcels.order_by("-municipal", "flr", "flrstck_zhlr", "flrstck_nnr") - rpp = 50 + rpp = 100 from_p = rpp * (page-1) to_p = rpp * (page) next_page = page + 1