From 0a8f2e7e72acf4c674291a9697c2dffc62f842be Mon Sep 17 00:00:00 2001 From: Ilan Steemers Date: Wed, 24 Feb 2016 10:44:47 +0100 Subject: [PATCH] Adds optional `task_name` argument Makes it possible to name the task yourself. --- django_q/tasks.py | 2 +- docs/tasks.rst | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/django_q/tasks.py b/django_q/tasks.py index 4af1788..5be767c 100644 --- a/django_q/tasks.py +++ b/django_q/tasks.py @@ -24,7 +24,7 @@ def async(func, *args, **kwargs): tag = uuid() # build the task package task = {'id': tag[1], - 'name': tag[0], + 'name': q_options.pop('task_name', None) or tag[0], 'func': func, 'args': args} # push optionals diff --git a/docs/tasks.rst b/docs/tasks.rst index 3fe1373..3bd6eb4 100644 --- a/docs/tasks.rst +++ b/docs/tasks.rst @@ -69,6 +69,11 @@ broker """""" A broker instance, in case you want to control your own connections. +task_name +""""""""" + +Optionally overwrites the auto-generated task name. + q_options """"""""" None of the option keywords get passed on to the task function.