本文整理匯總了Python中concepts.models.Concept.full_clean方法的典型用法代碼示例。如果您正苦於以下問題:Python Concept.full_clean方法的具體用法?Python Concept.full_clean怎麽用?Python Concept.full_clean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類concepts.models.Concept
的用法示例。
在下文中一共展示了Concept.full_clean方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_concept_display_name_preferred
# 需要導入模塊: from concepts.models import Concept [as 別名]
# 或者: from concepts.models.Concept import full_clean [as 別名]
def test_concept_display_name_preferred(self):
concept = Concept(
mnemonic='concept1',
created_by=self.user1,
updated_by=self.user1,
parent=self.source1,
concept_class='First',
)
display_name1 = LocalizedText(
name='concept1',
locale='en',
locale_preferred=True
)
concept.names.append(display_name1)
display_name2 = LocalizedText(
name='le concept1',
locale='fr'
)
concept.names.append(display_name2)
concept.full_clean()
concept.save()
self.assertTrue(Concept.objects.filter(mnemonic='concept1').exists())
self.assertFalse(concept.retired)
self.assertEquals(display_name1.name, concept.display_name)
self.assertEquals(display_name1.locale, concept.display_locale)
self.assertEquals(self.source1.owner_name, concept.owner_name)
self.assertEquals(self.source1.owner_type, concept.owner_type)
self.assertEquals(0, concept.num_versions)
示例2: test_create_concept_negative__no_class
# 需要導入模塊: from concepts.models import Concept [as 別名]
# 或者: from concepts.models.Concept import full_clean [as 別名]
def test_create_concept_negative__no_class(self):
with self.assertRaises(ValidationError):
concept = Concept(
mnemonic='concept1',
created_by=self.user1,
updated_by=self.user1,
parent=self.source1,
names=[self.name],
)
concept.full_clean()
concept.save()
示例3: test_create_concept_positive
# 需要導入模塊: from concepts.models import Concept [as 別名]
# 或者: from concepts.models.Concept import full_clean [as 別名]
def test_create_concept_positive(self):
concept = Concept(
mnemonic='concept1',
created_by=self.user1,
updated_by=self.user1,
parent=self.source1,
concept_class='First',
names=[self.name],
)
concept.full_clean()
concept.save()
self.assertTrue(Concept.objects.filter(mnemonic='concept1').exists())
self.assertFalse(concept.retired)
self.assertEquals(self.name.name, concept.display_name)
self.assertEquals(self.name.locale, concept.display_locale)
self.assertEquals(self.source1.owner_name, concept.owner_name)
self.assertEquals(self.source1.owner_type, concept.owner_type)
self.assertEquals(0, concept.num_versions)
示例4: test_concept_access_changes_with_source
# 需要導入模塊: from concepts.models import Concept [as 別名]
# 或者: from concepts.models.Concept import full_clean [as 別名]
def test_concept_access_changes_with_source(self):
public_access = self.source1.public_access
concept = Concept(
mnemonic='concept1',
created_by=self.user1,
updated_by=self.user1,
parent=self.source1,
public_access=public_access,
concept_class='First',
names=[self.name],
)
concept.full_clean()
concept.save()
self.assertEquals(self.source1.public_access, concept.public_access)
self.source1.public_access = ACCESS_TYPE_VIEW
self.source1.save()
concept = Concept.objects.get(id=concept.id)
self.assertNotEquals(public_access, self.source1.public_access)
self.assertEquals(self.source1.public_access, concept.public_access)