Changes between Initial Version and Version 1 of Ticket #34937
- Timestamp:
- Oct 30, 2023, 4:21:50 AM (13 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34937 – Description
initial v1 3 3 In understand that renaming `get_form` to `get_formclass` will likely break ''a lot'', so that is not an option, but we can define a `get_form_kwargs` which does not exists up till now, and then use this to generate optionally extra kwargs that are then injected when we *use* the form, so something like: 4 4 5 ``` 5 {{{ 6 6 ModelForm = self.get_form( 7 7 request, obj, change=not add, fields=flatten_fieldsets(fieldsets) … … 11 11 12 12 form = ModelForm(request.POST, request.FILES, instance=obj, **self.get_form_kwargs(request)) 13 ``` 13 }}} 14 14 15 15 in the `_chageform_view` for example. This makes it easy to inject for example the logged in user into the form, which is often done to limit the form fields.