Skip to content

"user-defined function raised exception" error when accessing PeriodicTask in the admin panel #831

Open
@angelojbgama

Description

@angelojbgama

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

image


Additional Information:

  1. Versions Used:

    • Django: 4.2
    • Django Celery Beat: v5.4.0
    • Celery: v5.4.0
    • Python: 3.12.8
  2. Steps to Reproduce:

    1. Configure PeriodicTaskAdmin with the date_hierarchy attribute:
      class PeriodicTaskAdmin(admin.ModelAdmin):
          date_hierarchy = 'start_time'
    2. Navigate to the admin page:
      http://localhost:3000/admin/django_celery_beat/periodictask/.
  3. Expected Behavior:
    The date_hierarchy field should work without raising exceptions.

  4. Actual Behavior:
    The error mentioned above is triggered, and the admin page fails to load. If I comment out date_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions