mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-02 01:38:11 +08:00
Adds name, function and task id to orm queue admin
This commit is contained in:
@@ -98,6 +98,9 @@ class QueueAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
'id',
|
||||
'key',
|
||||
'task_id',
|
||||
'name',
|
||||
'func',
|
||||
'lock'
|
||||
)
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ from django.dispatch import receiver
|
||||
from django.utils import timezone
|
||||
from picklefield import PickledObjectField
|
||||
from picklefield.fields import dbsafe_decode
|
||||
from django_q.signing import SignedPackage
|
||||
|
||||
|
||||
class Task(models.Model):
|
||||
@@ -193,6 +194,18 @@ class OrmQ(models.Model):
|
||||
payload = models.TextField()
|
||||
lock = models.DateTimeField(null=True)
|
||||
|
||||
def task(self):
|
||||
return SignedPackage.loads(self.payload)
|
||||
|
||||
def func(self):
|
||||
return self.task()['func']
|
||||
|
||||
def task_id(self):
|
||||
return self.task()['id']
|
||||
|
||||
def name(self):
|
||||
return self.task()['name']
|
||||
|
||||
class Meta:
|
||||
app_label = 'django_q'
|
||||
verbose_name = _('Queued task')
|
||||
|
||||
Reference in New Issue
Block a user