Ticket #14797: 14797.diff
File 14797.diff, 2.5 KB (added by , 14 years ago) |
---|
-
tests/regressiontests/generic_views/edit.py
7 7 from regressiontests.generic_views.models import Artist, Author 8 8 from regressiontests.generic_views import views 9 9 10 class ModelFormMixinTests(TestCase): 11 def test_get_form(self): 12 form_class = views.AuthorGetQuerySetFormView().get_form_class() 13 self.assertEqual(form_class.Meta.model, Author) 10 14 11 15 class CreateViewTests(TestCase): 12 16 urls = 'regressiontests.generic_views.urls' -
tests/regressiontests/generic_views/tests.py
1 1 from regressiontests.generic_views.base import ViewTest, TemplateViewTest, RedirectViewTest 2 2 from regressiontests.generic_views.dates import ArchiveIndexViewTests, YearArchiveViewTests, MonthArchiveViewTests, WeekArchiveViewTests, DayArchiveViewTests, DateDetailViewTests 3 3 from regressiontests.generic_views.detail import DetailViewTest 4 from regressiontests.generic_views.edit import CreateViewTests, UpdateViewTests, DeleteViewTests4 from regressiontests.generic_views.edit import ModelFormMixinTests, CreateViewTests, UpdateViewTests, DeleteViewTests 5 5 from regressiontests.generic_views.list import ListViewTests -
tests/regressiontests/generic_views/views.py
143 143 144 144 class BookDetail(BookConfig, generic.DateDetailView): 145 145 pass 146 147 class AuthorGetQuerySetFormView(generic.edit.ModelFormMixin): 148 def get_queryset(self): 149 return Author.objects.all() -
django/views/generic/edit.py
72 72 if self.form_class: 73 73 return self.form_class 74 74 else: 75 if self.model is None: 76 model = self.queryset.model 77 else: 78 model = self.model 75 model = self.get_queryset().model 79 76 return model_forms.modelform_factory(model) 80 77 81 78 def get_form(self, form_class):