Skip to content

Commit cd0dc18

Browse files
fix: is popup lost on filter (#868) (#869)
1 parent 87dc061 commit cd0dc18

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/unfold/admin.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from django.contrib.admin import StackedInline as BaseStackedInline
88
from django.contrib.admin import TabularInline as BaseTabularInline
99
from django.contrib.admin import display, helpers
10+
from django.contrib.admin.options import IS_POPUP_VAR, TO_FIELD_VAR
1011
from django.contrib.admin.widgets import RelatedFieldWidgetWrapper
1112
from django.db import models
1213
from django.db.models import BLANK_CHOICE_DASH, Model
@@ -472,7 +473,14 @@ def changelist_view(
472473
for action in self.get_actions_row(request)
473474
]
474475

475-
extra_context.update({"actions_list": actions, "actions_row": actions_row})
476+
extra_context.update(
477+
{
478+
"actions_list": actions,
479+
"actions_row": actions_row,
480+
"to_field_var": TO_FIELD_VAR,
481+
"is_popup_var": IS_POPUP_VAR,
482+
}
483+
)
476484

477485
return super().changelist_view(request, extra_context)
478486

src/unfold/templates/unfold/change_list_filter.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ <h3 class="border-b flex font-semibold mb-4 px-4 py-4 text-font-important-light
4545
{% if request.GET.o %}
4646
<input type="hidden" name="o" value="{{ request.GET.o }}">
4747
{% endif %}
48+
49+
{% if is_popup %}
50+
<input type="hidden" name="{{ is_popup_var }}" value="1">
51+
{% endif %}
52+
53+
{% if to_field %}
54+
<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">
55+
{% endif %}
56+
4857
{% endif %}
4958

5059
{% for spec in cl.filter_specs %}

0 commit comments

Comments
 (0)