mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-15 13:37:56 +08:00
Adds cron kwarg
This commit is contained in:
@@ -88,6 +88,7 @@ def schedule(func, *args, **kwargs):
|
||||
:param repeats: how many times to repeat. 0=never, -1=always.
|
||||
:param next_run: Next scheduled run.
|
||||
:type next_run: datetime.datetime
|
||||
:param cron: optional cron expression
|
||||
:param kwargs: function keyword arguments.
|
||||
:return: the schedule object.
|
||||
:rtype: Schedule
|
||||
@@ -98,6 +99,7 @@ def schedule(func, *args, **kwargs):
|
||||
minutes = kwargs.pop("minutes", None)
|
||||
repeats = kwargs.pop("repeats", -1)
|
||||
next_run = kwargs.pop("next_run", timezone.now())
|
||||
cron = kwargs.pop("cron", None)
|
||||
|
||||
# check for name duplicates instead of am unique constraint
|
||||
if name and Schedule.objects.filter(name=name).exists():
|
||||
@@ -114,6 +116,7 @@ def schedule(func, *args, **kwargs):
|
||||
minutes=minutes,
|
||||
repeats=repeats,
|
||||
next_run=next_run,
|
||||
cron=cron
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user