Hooking in djcelery admin to our admin interface
adding CeleryTask to the admin interfacepull/1/head
parent
69dde055b5
commit
55b3e8398e
19
admin.py
19
admin.py
|
@ -5,6 +5,9 @@ from django.contrib.admin.sites import AdminSite
|
|||
from regluit.core import models
|
||||
from regluit import payment
|
||||
|
||||
from djcelery.admin import TaskState, WorkerState, TaskMonitor, WorkerMonitor, \
|
||||
IntervalSchedule, CrontabSchedule, PeriodicTask, PeriodicTaskAdmin
|
||||
|
||||
|
||||
class RegluitAdmin(AdminSite):
|
||||
login_template = 'registration/login.html'
|
||||
|
@ -54,6 +57,9 @@ class WishlistAdmin(ModelAdmin):
|
|||
class UserProfileAdmin(ModelAdmin):
|
||||
date_hierarchy = 'created'
|
||||
|
||||
class CeleryTaskAdmin(ModelAdmin):
|
||||
pass
|
||||
|
||||
class TransactionAdmin(ModelAdmin):
|
||||
date_hierarchy = 'date_created'
|
||||
|
||||
|
@ -77,6 +83,19 @@ admin_site.register(models.Edition, EditionAdmin)
|
|||
admin_site.register(models.Ebook, EbookAdmin)
|
||||
admin_site.register(models.Wishlist, WishlistAdmin)
|
||||
admin_site.register(models.UserProfile, UserProfileAdmin)
|
||||
admin_site.register(models.CeleryTask, CeleryTaskAdmin)
|
||||
|
||||
# payments
|
||||
|
||||
admin_site.register(payment.models.Transaction, TransactionAdmin)
|
||||
admin_site.register(payment.models.PaymentResponse, PaymentResponseAdmin)
|
||||
admin_site.register(payment.models.Receiver, ReceiverAdmin)
|
||||
|
||||
# add the djcelery admin interface
|
||||
# https://raw.github.com/ask/django-celery/2.4/djcelery/admin.py
|
||||
|
||||
admin_site.register(TaskState, TaskMonitor)
|
||||
admin_site.register(WorkerState, WorkerMonitor)
|
||||
admin_site.register(IntervalSchedule)
|
||||
admin_site.register(CrontabSchedule)
|
||||
admin_site.register(PeriodicTask, PeriodicTaskAdmin)
|
||||
|
|
|
@ -26,7 +26,7 @@ class CeleryTask(models.Model):
|
|||
active = models.NullBooleanField(default=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return "Task %s arg:%d ID# %s %s: State %s " % (self.function_name, self.function_args, self.task_id, self.description, self.state)
|
||||
return "Task %s arg:%s ID# %s %s: State %s " % (self.function_name, self.function_args, self.task_id, self.description, self.state)
|
||||
|
||||
@property
|
||||
def AsyncResult(self):
|
||||
|
|
Loading…
Reference in New Issue