From abe7acf386e87a986c7ce82290c216fca972e45b Mon Sep 17 00:00:00 2001 From: Sergey Misuk Date: Thu, 3 Apr 2025 14:47:44 +0300 Subject: [PATCH 1/2] Create AsyncResult with Celery app --- src/django_celery_boost/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/django_celery_boost/models.py b/src/django_celery_boost/models.py index fe26721..d89c9d8 100644 --- a/src/django_celery_boost/models.py +++ b/src/django_celery_boost/models.py @@ -223,7 +223,7 @@ def celery_queue_info(cls) -> "dict[str, int]": def async_result(self) -> "AsyncResult|None": """Return the AsyncResult object of the current instance.""" if self.curr_async_result_id: - return AsyncResult(self.curr_async_result_id) + return self.celery_app.AsyncResult(self.curr_async_result_id) return None @property From 94efcd0713413ed391d770f987d5468605178b33 Mon Sep 17 00:00:00 2001 From: Sergey Misuk Date: Thu, 3 Apr 2025 18:16:38 +0300 Subject: [PATCH 2/2] Fix tests --- src/django_celery_boost/admin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/django_celery_boost/admin.py b/src/django_celery_boost/admin.py index 121ceb7..783a017 100644 --- a/src/django_celery_boost/admin.py +++ b/src/django_celery_boost/admin.py @@ -109,8 +109,8 @@ def doit(request: "HttpRequest") -> HttpResponseRedirect: self, request, doit, - "Do you really want to queue this task?", - "Queued", + message="Do you really want to queue this task?", + success_message="Queued", extra_context=ctx, description="", template=self.queue_template @@ -146,8 +146,8 @@ def doit(request: "HttpRequest") -> HttpResponseRedirect: self, request, doit, - "Do you really want to queue this task?", - "Revoked", + message="Do you really want to queue this task?", + success_message="Revoked", extra_context=ctx, description="", template=[ @@ -182,8 +182,8 @@ def doit(request: "HttpRequest") -> HttpResponseRedirect: self, request, doit, - "Do you really want to terminate this task?", - None, + message="Do you really want to terminate this task?", + success_message=None, extra_context=ctx, description="", template=self.terminate_template