本文整理匯總了Python中django.views方法的典型用法代碼示例。如果您正苦於以下問題:Python django.views方法的具體用法?Python django.views怎麽用?Python django.views使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django
的用法示例。
在下文中一共展示了django.views方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_crud_for_model
# 需要導入模塊: import django [as 別名]
# 或者: from django import views [as 別名]
def test_crud_for_model(self):
urls = crud_for_model(Author)
self.assertEqual(len(urls), 5)
self.assertEqual(urls[0].name, 'testapp_author_list')
self.assertIs(urls[0].callback.view_class, views.CRUDListView)
self.assertEqual(urls[1].name, 'testapp_author_create')
self.assertIs(urls[1].callback.view_class, views.CRUDCreateView)
self.assertEqual(urls[2].name, 'testapp_author_detail')
self.assertIs(urls[2].callback.view_class, views.CRUDDetailView)
self.assertEqual(urls[3].name, 'testapp_author_update')
self.assertIs(urls[3].callback.view_class, views.CRUDUpdateView)
self.assertEqual(urls[4].name, 'testapp_author_delete')
self.assertIs(urls[4].callback.view_class, views.CRUDDeleteView)