Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django admin date_hierarchy linking is not working anymore #374

Closed
jeroenpeters1986 opened this issue Mar 6, 2024 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@jeroenpeters1986
Copy link
Contributor

jeroenpeters1986 commented Mar 6, 2024

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 jeroenpeters1986 added the bug Something isn't working label Mar 6, 2024
jeroenpeters1986 added a commit to jeroenpeters1986/django-admin-interface that referenced this issue Mar 6, 2024
@fabiocaccamo
Copy link
Owner

@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!

@jeroenpeters1986
Copy link
Contributor Author

jeroenpeters1986 commented Mar 6, 2024

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

@fabiocaccamo
Copy link
Owner

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

@jeroenpeters1986
Copy link
Contributor Author

jeroenpeters1986 commented Mar 7, 2024 via email

jeroenpeters1986 added a commit to jeroenpeters1986/django-admin-interface that referenced this issue Mar 7, 2024
fabiocaccamo pushed a commit that referenced this issue Mar 7, 2024
* #374: Date hierarchy params fix

* #374: Backwards compatible changes
@fabiocaccamo
Copy link
Owner

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

@jeroenpeters1986
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants