示例#1
0
    def create(cls, user, name, description, project, assigned=None, open=True):
        """
        :param user User creating the issue
        :type user User
        """
        assert isinstance(project, Project)
        assert isinstance(user, User)

        kwargs = {}
        if assigned:
            kwargs['assigned_to_id'] = assigned.id
        if user:
            kwargs['created_by_id'] = user.id

        issue = super(Issue, cls).create(name=name, description=description, open=open,
                                         project_id = project.id, **kwargs)

        CreatedBy.create(issue, user)
        HasProject.create(issue, project)

        if assigned:
            AssignedTo.create(issue, assigned)


        issue.index()

        return issue
示例#2
0
    def create(cls, name, user):

        assert isinstance(user, User)
        project = super(Project, cls).create(name=name)
        CreatedBy.create(project, user)
        project.add_user(user)

        # create wiki
        from machete.wiki.models import Wiki, HasWiki
        wiki = Wiki.create()
        HasWiki.create(project, wiki)

        return project