I have no need to the celery modules in my Django admin. Is there a way I could remove it?
Django admin allows access to users marked as is_staff=True . To disable a user from being able to access the admin, you should set is_staff=False . This holds true even if the user is a superuser. is_superuser=True .
You can add another class called Meta in your model to specify plural display name. For example, if the model's name is Category , the admin displays Categorys , but by adding the Meta class, we can change it to Categories . Literally saved my life!
We have a lot of tools in Django to customize it to our own needs and in this article, we'll learn how to customize the admin interface and add multiple features: Let's setup your project, add models into models.py and register your models.
To be more specific, in admin.py
of any app inside INSTALLED_APPS
after 'djcelery'
from django.contrib import admin
from djcelery.models import (
TaskState, WorkerState, PeriodicTask,
IntervalSchedule, CrontabSchedule)
admin.site.unregister(TaskState)
admin.site.unregister(WorkerState)
admin.site.unregister(IntervalSchedule)
admin.site.unregister(CrontabSchedule)
admin.site.unregister(PeriodicTask)
Updated version looks like:
from django_celery_beat.models import (
IntervalSchedule,
CrontabSchedule,
SolarSchedule,
ClockedSchedule,
PeriodicTask,
)
admin.site.unregister(SolarSchedule)
admin.site.unregister(ClockedSchedule)
admin.site.unregister(PeriodicTask)
admin.site.unregister(IntervalSchedule)
admin.site.unregister(CrontabSchedule)
You always can get a list of registered models via:
admin.site._registry
You can simply unregister celerys models like admin.site.unregister(CeleryModelIdoNotWantInAdmin)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With