Ticket #9651: 9651-r10336.diff
File 9651-r10336.diff, 3.5 KB (added by , 16 years ago) |
---|
-
django/forms/models.py
530 530 # Remove the primary key from the form's data, we are only 531 531 # creating new instances 532 532 form.data[form.add_prefix(self._pk_field.name)] = None 533 534 # Remove the foreign key from the form's data 535 form.data[form.add_prefix(self.fk.name)] = None 533 536 return form 534 537 535 538 #@classmethod -
tests/regressiontests/admin_views/tests.py
94 94 "article_set-0-content": u"<p>Middle content</p>", 95 95 "article_set-0-date_0": u"2008-03-18", 96 96 "article_set-0-date_1": u"11:54:58", 97 "article_set-0-section": u"1", 97 98 "article_set-1-id": u"2", 98 99 "article_set-1-title": u"Need a title.", 99 100 "article_set-1-content": u"<p>Oldest content</p>", 100 101 "article_set-1-date_0": u"2000-03-18", 101 102 "article_set-1-date_1": u"11:54:58", 103 "article_set-1-section": u"1", 102 104 "article_set-2-id": u"3", 103 105 "article_set-2-title": u"Need a title.", 104 106 "article_set-2-content": u"<p>Newest content</p>", 105 107 "article_set-2-date_0": u"2009-03-18", 106 108 "article_set-2-date_1": u"11:54:58", 109 "article_set-2-section": u"1", 107 110 "article_set-3-id": u"", 108 111 "article_set-3-title": u"", 109 112 "article_set-3-content": u"", 110 113 "article_set-3-date_0": u"", 111 114 "article_set-3-date_1": u"", 115 "article_set-3-section": u"1", 112 116 "article_set-4-id": u"", 113 117 "article_set-4-title": u"", 114 118 "article_set-4-content": u"", 115 119 "article_set-4-date_0": u"", 116 120 "article_set-4-date_1": u"", 121 "article_set-4-section": u"1", 117 122 "article_set-5-id": u"", 118 123 "article_set-5-title": u"", 119 124 "article_set-5-content": u"", 120 125 "article_set-5-date_0": u"", 121 126 "article_set-5-date_1": u"", 127 "article_set-5-section": u"1", 122 128 } 123 129 response = self.client.post('/test_admin/%s/admin_views/section/1/' % self.urlbit, post_data) 124 130 self.failUnlessEqual(response.status_code, 302) # redirect somewhere 125 131 132 # test save_as 133 post_data.update({'_saveasnew': u'Save+as+new',}) 134 response = self.client.post('/test_admin/%s/admin_views/section/1/' % self.urlbit, post_data) 135 self.failUnlessEqual(response.status_code, 302) # redirect somewhere 136 137 126 138 def testChangeListSortingCallable(self): 127 139 """ 128 140 Ensure we can sort on a list_display field that is a callable -
tests/regressiontests/admin_views/models.py
287 287 288 288 admin.site.register(Article, ArticleAdmin) 289 289 admin.site.register(CustomArticle, CustomArticleAdmin) 290 admin.site.register(Section, inlines=[ArticleInline])290 admin.site.register(Section, save_as=True, inlines=[ArticleInline]) 291 291 admin.site.register(ModelWithStringPrimaryKey) 292 292 admin.site.register(Color) 293 293 admin.site.register(Thing, ThingAdmin)