Skip to content

Preserve other filters when clearing the admin date hierarchy - #501

Open
Lushiyao5 wants to merge 1 commit into
fabiocaccamo:mainfrom
Lushiyao5:fix/date-hierarchy-removal-filters-20261117
Open

Lushiyao5 wants to merge 1 commit into
fabiocaccamo:mainfrom
Lushiyao5:fix/date-hierarchy-removal-filters-20261117

Conversation

@Lushiyao5

Copy link
Copy Markdown

Describe your changes

The date hierarchy quick removal link clears any filter whose name starts with the hierarchy field. With last_login__year=2022, it also drops filters such as last_login_method=sso and last_login__year__gte=2020.

Delete the exact year, month, and day parameters using Django's ChangeList.get_query_string(new_params=...). The regression test checks that clearing the selected year preserves both nearby filters.

Related issue

Found while reviewing the date hierarchy template tag.

Checklist before requesting a review

  • I have performed a self-review of the diff.
  • I have added a regression test.
  • I ran python runtests.py on Django 5.2.10 (44 passed) and checked both changed files with Ruff.

Prepared with OpenAI Codex assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant