fabiocaccamo/django-admin-interface

Django admin date_hierarchy linking is not working anymore

jeroenpeters1986 opened this issue · 6 comments

Python version
3.11

Django version
5.0.2

Package version
0.28.5

Current behavior (bug description)
I am using the "date_hierarchy" (https://docs.djangoproject.com/en/5.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.date_hierarchy) function on a Django model. With version 0.28.5 I am getting this error when I click on the Year

TypeError at /nl/admin/budgie_bird/bird/
int() argument must be a string, a bytes-like object or a real number, not 'list'
Request Method:	GET
Request URL:	https://pybudgie.ddev.site/nl/admin/budgie_bird/bird/?date_of_birth__year=2020
Django Version:	5.0.2
Exception Type:	TypeError
Exception Value:	
int() argument must be a string, a bytes-like object or a real number, not 'list'
Exception Location:	/var/www/html/.ddev/.venv/lib/python3.11/site-packages/admin_interface/templatetags/admin_interface_tags.py, line 147, in admin_interface_date_hierarchy_removal_link
Raised during:	django.contrib.admin.options.changelist_view

Expected behavior
It seems that the received params have changes and are now a list instead of the string from the URL

I will submit a PR, I am not sure if this is because of Django5 or earlier

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

@jeroenpeters1986 thank you for having reported this issue!

The error is raised here, so I'm pretty sure it's an issue related with the latest django version.

If you can submit a PR with a backward-compatible fix that would be great!

Hi @fabiocaccamo thank you for your fast reply! I will edit my PR tomorrow so that it will work on both versions :-)

@jeroenpeters1986 yes, I saw that it doesn't pass the tests...

@jeroenpeters1986 thanks for the PR, you can upgrade to 0.28.6 version.

Thanks so much! I will upgrade it tonight. Thanks so much for the awesome package, glad I could do something 'back'