本文整理匯總了Python中django.contrib.admindocs.views.get_readable_field_data_type方法的典型用法代碼示例。如果您正苦於以下問題:Python views.get_readable_field_data_type方法的具體用法?Python views.get_readable_field_data_type怎麽用?Python views.get_readable_field_data_type使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.contrib.admindocs.views
的用法示例。
在下文中一共展示了views.get_readable_field_data_type方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_field_name
# 需要導入模塊: from django.contrib.admindocs import views [as 別名]
# 或者: from django.contrib.admindocs.views import get_readable_field_data_type [as 別名]
def test_field_name(self):
self.assertRaises(
AttributeError,
views.get_readable_field_data_type, "NotAField"
)
示例2: test_builtin_fields
# 需要導入模塊: from django.contrib.admindocs import views [as 別名]
# 或者: from django.contrib.admindocs.views import get_readable_field_data_type [as 別名]
def test_builtin_fields(self):
self.assertEqual(
views.get_readable_field_data_type(fields.BooleanField()),
_('Boolean (Either True or False)')
)
示例3: test_custom_fields
# 需要導入模塊: from django.contrib.admindocs import views [as 別名]
# 或者: from django.contrib.admindocs.views import get_readable_field_data_type [as 別名]
def test_custom_fields(self):
self.assertEqual(
views.get_readable_field_data_type(CustomField()),
'A custom field type'
)
self.assertEqual(
views.get_readable_field_data_type(DescriptionLackingField()),
_('Field of type: %(field_type)s') % {
'field_type': 'DescriptionLackingField'
}
)
示例4: test_field_name
# 需要導入模塊: from django.contrib.admindocs import views [as 別名]
# 或者: from django.contrib.admindocs.views import get_readable_field_data_type [as 別名]
def test_field_name(self):
self.assertRaises(AttributeError,
views.get_readable_field_data_type, "NotAField"
)