Update docker #159
@ -1,22 +1,22 @@
|
|||||||
{% load l10n i18n %}
|
{% load l10n i18n %}
|
||||||
{% for parcel in parcels %}
|
{% for parcel in parcels %}
|
||||||
<tr>
|
{% if forloop.last and next_page %}
|
||||||
<td>{{parcel.parcel_group.name|default_if_none:"-"}}</td>
|
<tr hx-get="{% url 'geometry-parcels-content' geom_id next_page %}"
|
||||||
<td>{{parcel.parcel_group.key|default_if_none:"-"}}</td>
|
hx-trigger="intersect once"
|
||||||
<td>{{parcel.flr|default_if_none:"-"|unlocalize}}</td>
|
hx-swap="afterend">
|
||||||
<td>{{parcel.flrstck_zhlr|default_if_none:"-"|unlocalize}}</td>
|
<td>{{parcel.parcel_group.name|default_if_none:"-"}}</td>
|
||||||
<td>{{parcel.flrstck_nnr|default_if_none:"-"|unlocalize}}</td>
|
<td>{{parcel.parcel_group.key|default_if_none:"-"}}</td>
|
||||||
</tr>
|
<td>{{parcel.flr|default_if_none:"-"|unlocalize}}</td>
|
||||||
|
<td>{{parcel.flrstck_zhlr|default_if_none:"-"|unlocalize}}</td>
|
||||||
|
<td>{{parcel.flrstck_nnr|default_if_none:"-"|unlocalize}}</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td>{{parcel.parcel_group.name|default_if_none:"-"}}</td>
|
||||||
|
<td>{{parcel.parcel_group.key|default_if_none:"-"}}</td>
|
||||||
|
<td>{{parcel.flr|default_if_none:"-"|unlocalize}}</td>
|
||||||
|
<td>{{parcel.flrstck_zhlr|default_if_none:"-"|unlocalize}}</td>
|
||||||
|
<td>{{parcel.flrstck_nnr|default_if_none:"-"|unlocalize}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if next_page %}
|
|
||||||
<tr id="nextButton">
|
|
||||||
<td class="text-center" colspan="5">
|
|
||||||
<button class="btn btn-default w-50"
|
|
||||||
hx-get="{% url 'geometry-parcels-content' geom_id next_page %}"
|
|
||||||
hx-target="#nextButton"
|
|
||||||
hx-swap="outerHTML">
|
|
||||||
{% trans 'Show more...' %}
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
@ -36,7 +36,7 @@
|
|||||||
<th scope="col">{% trans 'Parcel number' %}</th>
|
<th scope="col">{% trans 'Parcel number' %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="m5">
|
<tbody>
|
||||||
{% include 'konova/includes/parcels/parcel_table_content.html' %}
|
{% include 'konova/includes/parcels/parcel_table_content.html' %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -110,7 +110,7 @@ def get_geom_parcels(request: HttpRequest, id: str):
|
|||||||
id (str): The geometry's id
|
id (str): The geometry's id
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
A rendered piece of HTML
|
||||||
"""
|
"""
|
||||||
# HTTP code 286 states that the HTMX should stop polling for updates
|
# HTTP code 286 states that the HTMX should stop polling for updates
|
||||||
# https://htmx.org/docs/#polling
|
# 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 = parcels.order_by("municipal").distinct("municipal").values("municipal__id")
|
||||||
municipals = Municipal.objects.filter(id__in=municipals)
|
municipals = Municipal.objects.filter(id__in=municipals)
|
||||||
|
|
||||||
rpp = 50
|
rpp = 100
|
||||||
parcels = parcels[:rpp]
|
parcels = parcels[:rpp]
|
||||||
next_page = 1
|
next_page = 1
|
||||||
if len(parcels) < rpp:
|
if len(parcels) < rpp:
|
||||||
@ -153,7 +153,20 @@ def get_geom_parcels(request: HttpRequest, id: str):
|
|||||||
|
|
||||||
|
|
||||||
@login_required
|
@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:
|
if page < 0:
|
||||||
raise AssertionError("Parcel page can not be negative")
|
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 = geom.get_underlying_parcels()
|
||||||
|
|
||||||
parcels = parcels.order_by("-municipal", "flr", "flrstck_zhlr", "flrstck_nnr")
|
parcels = parcels.order_by("-municipal", "flr", "flrstck_zhlr", "flrstck_nnr")
|
||||||
rpp = 50
|
rpp = 100
|
||||||
from_p = rpp * (page-1)
|
from_p = rpp * (page-1)
|
||||||
to_p = rpp * (page)
|
to_p = rpp * (page)
|
||||||
next_page = page + 1
|
next_page = page + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user