コード例 #1
0
def create_tasks_in_bulk(bulk_data, callback=None, precall=None, **additional_fields):
    """Create tasks from `bulk_data`.

    :param bulk_data: List of tasks in bulk format.
    :param callback: Callback to execute after each task save.
    :param additional_fields: Additional fields when instantiating each task.

    :return: List of created `Task` instances.
    """
    tasks = get_tasks_from_bulk(bulk_data, **additional_fields)

    disconnect_tasks_signals()

    try:
        db.save_in_bulk(tasks, callback, precall)
    finally:
        connect_tasks_signals()

    return tasks
コード例 #2
0
ファイル: services.py プロジェクト: aminadha/taiga-back
def create_tasks_in_bulk(bulk_data, callback=None, precall=None, **additional_fields):
    """Create tasks from `bulk_data`.

    :param bulk_data: List of tasks in bulk format.
    :param callback: Callback to execute after each task save.
    :param additional_fields: Additional fields when instantiating each task.

    :return: List of created `Task` instances.
    """
    tasks = get_tasks_from_bulk(bulk_data, **additional_fields)

    disconnect_tasks_signals()

    try:
        db.save_in_bulk(tasks, callback, precall)
    finally:
        connect_tasks_signals()

    return tasks
コード例 #3
0
ファイル: api.py プロジェクト: Type-of-Teamlab/taiga-back
    def destroy(self, request, *args, **kwargs):
        from taiga.events.apps import connect_events_signals, disconnect_events_signals
        from taiga.projects.tasks.apps import connect_tasks_signals, disconnect_tasks_signals
        from taiga.projects.userstories.apps import connect_userstories_signals, disconnect_userstories_signals
        from taiga.projects.issues.apps import connect_issues_signals, disconnect_issues_signals
        from taiga.projects.apps import connect_memberships_signals, disconnect_memberships_signals

        obj = self.get_object_or_none()
        self.check_permissions(request, 'destroy', obj)

        if obj is None:
            raise Http404

        disconnect_events_signals()
        disconnect_issues_signals()
        disconnect_tasks_signals()
        disconnect_userstories_signals()
        disconnect_memberships_signals()

        try:
            obj.tasks.all().delete()
            obj.user_stories.all().delete()
            obj.issues.all().delete()
            obj.memberships.all().delete()
            obj.roles.all().delete()
        finally:
            connect_events_signals()
            connect_issues_signals()
            connect_tasks_signals()
            connect_userstories_signals()
            connect_memberships_signals()

        self.pre_delete(obj)
        self.pre_conditions_on_delete(obj)
        obj.delete()
        self.post_delete(obj)
        return response.NoContent()