Opened 11 years ago

Closed 11 years ago

#20644 closed Cleanup/optimization (fixed)

ModelFormMixin.fields not present in flattened index

Reported by: Baptiste Mispelon Owned by: Baptiste Mispelon
Component: Generic views Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

f026a519aea8f3ea7ca339bfbbb007e1ee0068b0 introduced the new fields attribute on ModelFormMixin which allows views like CreateView or UpdateView to define which model fields should be present on the dynamically created form.

However, this new attribute was not added to the flattened index page [1].

Note that technically, the ModelFormMixin does not have a fields attribute, but rather the implementation of ModelFormMixin.get_form_class [2] does a getattr(self, 'fields', None).
I don't see any reason for using getattr instead of simply declaring the fields attribute on the mixin itself so I think it should be changed too.

[1] https://github.com/django/django/blob/master/docs/ref/class-based-views/flattened-index.txt
[2] https://github.com/django/django/blob/master/django/views/generic/edit.py#L112

Change History (3)

comment:1 by Baptiste Mispelon, 11 years ago

Has patch: set

comment:2 by Tim Graham, 11 years ago

Triage Stage: UnreviewedReady for checkin

comment:3 by Baptiste Mispelon <bmispelon@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 299983616ffc146a6f5aa03af9b3f4a56853f05c:

Fixed #20644 -- Add ModelFormMixin.fields to the CBV flattened index

Thanks to Tim Graham for the report and review.

Note: See TracTickets for help on using tickets.
Back to Top