[FIX] HORILLA VIEWS: URi too long issue

This commit is contained in:
Horilla
2025-03-11 12:31:51 +05:30
parent 5a504cb75a
commit 37c34bf6f9
3 changed files with 6 additions and 7 deletions

View File

@@ -162,15 +162,13 @@ class HorillaListView(ListView):
if not self.bulk_update_accessibility():
return HttpResponse("You dont have permission")
ids = eval_validate(request.POST.get("instance_ids", "[]"))
form = self.get_bulk_form()
form.verbose_name = (
form.verbose_name
+ f" ({len((eval_validate(request.GET.get('instance_ids','[]'))))} {_('Records')})"
)
form.verbose_name = form.verbose_name + f" ({len((ids))} {_('Records')})"
return render(
request,
self.bulk_template,
{"form": form, "post_bulk_path": self.post_bulk_path},
{"form": form, "post_bulk_path": self.post_bulk_path, "instance_ids": ids},
)
def handle_bulk_submission(self, request: HttpRequest) -> HttpRequest:
@@ -180,7 +178,7 @@ class HorillaListView(ListView):
if not self.bulk_update_accessibility():
return HttpResponse("You dont have permission")
instance_ids = request.GET.get("instance_ids", "[]")
instance_ids = request.POST.get("instance_ids", "[]")
instance_ids = eval_validate(instance_ids)
form = DynamicBulkUpdateForm(
request.POST,

View File

@@ -1,4 +1,5 @@
<form hx-post="/{{post_bulk_path}}?{{request.GET.urlencode}}" method="post" hx-swap="outerHTML" hx-encoding="multipart/form-data">
<input type="hidden" name="instance_ids" value="{{instance_ids|safe}}">
{% csrf_token %}
{% include "generic/form.html" %}
</form>

View File

@@ -98,7 +98,7 @@
</span>)
</div>
<form
hx-get="/{{bulk_path}}"
hx-post="/{{bulk_path}}"
hx-target="#bulkUpdateModalBody{{view_id|safe}}">
<input type="hidden" name="instance_ids">
<button type="submit" id="bulk_update_get_form{{view_id}}" hidden>