#14797: ModelFormMixin's get_form_class() logic broken; fails with custom get_queryset() method ---------------------------+------------------------------------------------ Reporter: gg | Owner: gg Status: new | Milestone: 1.3 Component: Uncategorized | Version: SVN Keywords: | Stage: Unreviewed Has_patch: 0 | ---------------------------+------------------------------------------------ In the ModelFormMixin's get_form_class(), the logic in the else clause is broken:
- if self.model is set, it uses that instead of the queryset (whereas according to [http://docs.djangoproject.com/en/dev/ref/class-based- views/#django.views.generic.detail.SingleObjectMixin.queryset the docs] "the value of SingleObjectMixin.queryset supersedes the value provided for SingleObjectMixin.model") - if self.model is not set, it uses self.queryset.model, ignoring the get_queryset() method The attached patch fixes both issues As an aside, perhaps SingleObjectMixin should have a get_model() method that encapsulates and/or shortcuts this logic? On the one hand, using get_queryset().model isn't particularly intuitive, but on the other hand having get_model() may be getting a little too fine-grained. -- Ticket URL: <http://code.djangoproject.com/ticket/14797> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
