本文整理汇总了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)
示例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