当前位置: 首页>>代码示例>>Python>>正文


Python Issue.full_clean方法代码示例

本文整理汇总了Python中issues.models.Issue.full_clean方法的典型用法代码示例。如果您正苦于以下问题:Python Issue.full_clean方法的具体用法?Python Issue.full_clean怎么用?Python Issue.full_clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在issues.models.Issue的用法示例。


在下文中一共展示了Issue.full_clean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_create_proposal

# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import full_clean [as 别名]
    def test_create_proposal(self):
        i = Issue(community=self.community, title="Issue ABC",
                  created_by=self.chairmen[0])
        i.full_clean()
        i.save()

        title = 'Proposal XYZ'
        content = 'hellow world'

        self.assertEquals(0, Proposal.objects.count())

        self.login_chairmen()
        url = reverse('proposal_create', args=(self.community.id, i.id))
        response = self.client.get(url)
        self.assertEquals(200, response.status_code)
        response = self.client.post(url, {
            'proposal-type': ProposalType.RULE,
            'proposal-title': title,
            'proposal-content': content,
            'proposal-tags': 'tag1,tag2,tag3',
        })
        self.assertEquals(200, response.status_code)
        # Ajax call returns a partial html
        self.assertEquals(1, Proposal.objects.count())
        p = Proposal.objects.all()[0]
        assert isinstance(p, Proposal)
        self.assertContains(response, p.get_absolute_url())
        self.assertEquals(title, p.title)
        self.assertEquals(content, p.content)
开发者ID:VehpuS,项目名称:OpenCommunity,代码行数:31,代码来源:issue_ui_test.py

示例2: test_vote_proposal

# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import full_clean [as 别名]
    def test_vote_proposal(self):
#        p = self.test_create_proposal()
        ######################################
        i = Issue(community=self.community, title="Issue ABC",
            created_by=self.chairmen[0])
        i.full_clean()
        i.save()
        title = 'Proposal XYZ'
        content = 'hellow world'
        p = Proposal.objects.create(type=ProposalType.RULE, issue=i, created_by=self.chairmen[0], title=title, content=content)
        ######################################
        #TODO: create this via HTML request
        pv = ProposalVote(proposal=p, user=self.members[0], value=ProposalVoteValue.CON)
        pv.full_clean()
        pv.save()
        return pv
开发者ID:Amannor,项目名称:OpenCommunity,代码行数:18,代码来源:issue_ui_test.py


注:本文中的issues.models.Issue.full_clean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。