Ticket #9663: save_as_inline_tests.diff
File save_as_inline_tests.diff, 3.0 KB (added by , 16 years ago) |
---|
-
tests/regressiontests/admin_views/tests.py
80 80 "article_set-0-content": u"<p>Middle content</p>", 81 81 "article_set-0-date_0": u"2008-03-18", 82 82 "article_set-0-date_1": u"11:54:58", 83 'article_set-0-section': u'1', 84 83 85 "article_set-1-id": u"2", 84 86 "article_set-1-title": u"Need a title.", 85 87 "article_set-1-content": u"<p>Oldest content</p>", 86 88 "article_set-1-date_0": u"2000-03-18", 87 89 "article_set-1-date_1": u"11:54:58", 90 'article_set-1-section': u'1', 91 88 92 "article_set-2-id": u"3", 89 93 "article_set-2-title": u"Need a title.", 90 94 "article_set-2-content": u"<p>Newest content</p>", 91 95 "article_set-2-date_0": u"2009-03-18", 92 96 "article_set-2-date_1": u"11:54:58", 97 'article_set-2-section': u'1', 98 93 99 "article_set-3-id": u"", 94 100 "article_set-3-title": u"", 95 101 "article_set-3-content": u"", 96 102 "article_set-3-date_0": u"", 97 103 "article_set-3-date_1": u"", 104 'article_set-3-section': u'1', 105 98 106 "article_set-4-id": u"", 99 107 "article_set-4-title": u"", 100 108 "article_set-4-content": u"", 101 109 "article_set-4-date_0": u"", 102 110 "article_set-4-date_1": u"", 111 'article_set-4-section': u'1', 112 103 113 "article_set-5-id": u"", 104 114 "article_set-5-title": u"", 105 115 "article_set-5-content": u"", 106 116 "article_set-5-date_0": u"", 107 117 "article_set-5-date_1": u"", 118 'article_set-5-section': u'1', 108 119 } 109 120 response = self.client.post('/test_admin/admin/admin_views/section/1/', post_data) 110 121 self.failUnlessEqual(response.status_code, 302) # redirect somewhere 111 122 123 # test save_as 124 post_data.update({ 125 '_saveasnew': u'Save+as+new', 126 }) 127 128 response = self.client.post('/test_admin/admin/admin_views/section/1/', post_data) 129 self.failUnlessEqual(response.status_code, 302) # redirect somewhere 130 112 131 def testChangeListSortingCallable(self): 113 132 """ 114 133 Ensure we can sort on a list_display field that is a callable -
tests/regressiontests/admin_views/models.py
91 91 92 92 admin.site.register(Article, ArticleAdmin) 93 93 admin.site.register(CustomArticle, CustomArticleAdmin) 94 admin.site.register(Section, inlines=[ArticleInline])94 admin.site.register(Section, save_as=True, inlines=[ArticleInline]) 95 95 admin.site.register(ModelWithStringPrimaryKey) 96 96 admin.site.register(Color) 97 97 admin.site.register(Thing, ThingAdmin)