Description
Description:
I am encountering an error when trying to access the PeriodicTask page in the Django Celery Beat admin panel.
Error Details:
The error occurs in the following template line:
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
The issue is resolved when I comment out the following line in PeriodicTaskAdmin
:
date_hierarchy = 'start_time'
Admin Access URL:
The error appears when accessing:
http://localhost:3000/admin/django_celery_beat/periodictask/
Error Message:
user-defined function raised exception
Additional Information:
-
Versions Used:
- Django: 4.2
- Django Celery Beat: v5.4.0
- Celery: v5.4.0
- Python: 3.12.8
-
Steps to Reproduce:
- Configure
PeriodicTaskAdmin
with thedate_hierarchy
attribute:class PeriodicTaskAdmin(admin.ModelAdmin): date_hierarchy = 'start_time'
- Navigate to the admin page:
http://localhost:3000/admin/django_celery_beat/periodictask/
.
- Configure
-
Expected Behavior:
Thedate_hierarchy
field should work without raising exceptions. -
Actual Behavior:
The error mentioned above is triggered, and the admin page fails to load. If I comment outdate_hierarchy
, the page works as expected.
Relevant Code:
File: admin.py
from django.contrib import admin
from django_celery_beat.models import PeriodicTask
class PeriodicTaskAdmin(admin.ModelAdmin):
date_hierarchy = 'start_time'
admin.site.register(PeriodicTask, PeriodicTaskAdmin)
Template Line Causing Error:
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
Notes:
If additional information or testing is required to identify the root cause of this issue, please let me know. I am happy to assist in debugging this further.