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

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

Open
angelojbgama opened this issue Dec 16, 2024 · 0 comments

Comments

@angelojbgama
Copy link

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.

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

No branches or pull requests

1 participant