Пример #1
0
def create_related_userstories_in_bulk(bulk_data, epic, **additional_fields):
    """Create user stories from `bulk_data`.

    :param epic: Element where all the user stories will be contained
    :param bulk_data: List of user stories in bulk format.
    :param additional_fields: Additional fields when instantiating each user story.

    :return: List of created `Task` instances.
    """
    userstories = get_userstories_from_bulk(bulk_data, **additional_fields)
    project = additional_fields.get("project")

    # Set default swimlane if kanban module is enabled
    if project.is_kanban_activated:
        for user_story in userstories:
            user_story.swimlane = project.default_swimlane

    disconnect_userstories_signals()

    try:
        db.save_in_bulk(userstories)
        related_userstories = []
        for userstory in userstories:
            related_userstories.append(
                models.RelatedUserStory(user_story=userstory, epic=epic))
        db.save_in_bulk(related_userstories)
        project.update_role_points(user_stories=userstories)
    finally:
        connect_userstories_signals()

    return related_userstories
Пример #2
0
def create_related_userstories_in_bulk(bulk_data, epic, **additional_fields):
    """Create user stories from `bulk_data`.

    :param epic: Element where all the user stories will be contained
    :param bulk_data: List of user stories in bulk format.
    :param additional_fields: Additional fields when instantiating each user story.

    :return: List of created `Task` instances.
    """
    userstories = get_userstories_from_bulk(bulk_data, **additional_fields)
    disconnect_userstories_signals()

    try:
        db.save_in_bulk(userstories)
        related_userstories = []
        for userstory in userstories:
            related_userstories.append(
                models.RelatedUserStory(
                    user_story=userstory,
                    epic=epic
                )
            )
        db.save_in_bulk(related_userstories)
    finally:
        connect_userstories_signals()

    return related_userstories
Пример #3
0
def create_related_userstories_in_bulk(bulk_data, epic, **additional_fields):
    """Create user stories from `bulk_data`.

    :param epic: Element where all the user stories will be contained
    :param bulk_data: List of user stories in bulk format.
    :param additional_fields: Additional fields when instantiating each user story.

    :return: List of created `Task` instances.
    """
    userstories = get_userstories_from_bulk(bulk_data, **additional_fields)
    disconnect_userstories_signals()

    try:
        db.save_in_bulk(userstories)
        related_userstories = []
        for userstory in userstories:
            related_userstories.append(
                models.RelatedUserStory(
                    user_story=userstory,
                    epic=epic
                )
            )
        db.save_in_bulk(related_userstories)
    finally:
        connect_userstories_signals()

    return related_userstories
Пример #4
0
def create_userstories_in_bulk(bulk_data, callback=None, precall=None, **additional_fields):
    """Create user stories from `bulk_data`.

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

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

    disconnect_userstories_signals()

    try:
        db.save_in_bulk(userstories, callback, precall)
    finally:
        connect_userstories_signals()

    return userstories
Пример #5
0
def create_userstories_in_bulk(bulk_data, callback=None, precall=None, **additional_fields):
    """Create user stories from `bulk_data`.

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

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

    disconnect_userstories_signals()

    try:
        db.save_in_bulk(userstories, callback, precall)
    finally:
        connect_userstories_signals()

    return userstories
Пример #6
0
    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()