U
    bh                     @   s4   d dl Z d dlmZ d dlmZ G dd deZdS )    N)transaction)Taskc                   @   s,   e Zd ZdZddddZddddZdS )
DjangoTaskz
    Extend the base :class:`~celery.app.task.Task` for Django.

    Provide a nicer API to trigger tasks at the end of the DB transaction.
    N)returnc                 O   s   t tj| jf|| dS )zGCall :meth:`~celery.app.task.Task.delay` with Django's ``on_commit()``.N)r   	on_commit	functoolspartialdelayselfargskwargs r   >/tmp/pip-unpacked-wheel-kcem4wq5/celery/contrib/django/task.pydelay_on_commit   s    zDjangoTask.delay_on_commitc                 O   s   t tj| jf|| dS )zMCall :meth:`~celery.app.task.Task.apply_async` with Django's ``on_commit()``.N)r   r   r   r   Zapply_asyncr
   r   r   r   apply_async_on_commit   s    z DjangoTask.apply_async_on_commit)__name__
__module____qualname____doc__r   r   r   r   r   r   r      s   r   )r   Z	django.dbr   Zcelery.app.taskr   r   r   r   r   r   <module>   s   