[Django] #29956: Allow formset form widget override for the ORDER field

78 views
Skip to first unread message

Django

unread,
Nov 15, 2018, 11:19:53 AM11/15/18
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
----------------------------------------+------------------------
Reporter: Claude Paroz | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------+------------------------
It would be handy to be able to override the widget of the added `ORDER`
field of a formset form with `can_order=True`. The typical use case is to
use a `HiddenInput` to manage the formset ordering in the UI without a
visible form field.
At first sight, I think this could be easily doable in the
`BaseFormSet.add_fields` method.

--
Ticket URL: <https://code.djangoproject.com/ticket/29956>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 16, 2018, 9:13:03 AM11/16/18
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------

Reporter: Claude Paroz | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:1>

Django

unread,
Nov 17, 2018, 6:38:55 PM11/17/18
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: 2.1

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------
Changes (by Hasan Ramezani):

* owner: nobody => Hasan Ramezani
* status: new => assigned
* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:2>

Django

unread,
Nov 20, 2018, 2:25:46 PM11/20/18
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: 2.1

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------

Comment (by Hasan Ramezani):

Here is the summary of conversation between me and @claudep on the
[https://github.com/django/django/pull/10660#issuecomment-440327124 PR] :

I did this feature by adding the `order_field_widget` to `formset_factory`
functions. (now available in the PR)

@claudep suggested managing this by adding a key in `widgets` property of
`ModelForm`. something like this:

{{{
class AuthorForm(ModelForm):
class Meta:
model = Author
fields = ('name', 'title', 'birth_date')
widgets = {
'ORDER': HiddenInput(),
}
}}}

It works for `ModelForm` because we can access the `widgets` property of
ModelForm by : `model_form._meta.widgets`.
But it is possible to have this feature for `formset` which generated by
the normal forms, because the normal form that inherits from `forms.Form`
has not the `widgets` property.

So @claudep suggest to first add this feature just for ModelForm.

what is the final decision?

--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:3>

Django

unread,
Nov 20, 2018, 6:47:25 PM11/20/18
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: 2.1

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:4>

Django

unread,
Nov 21, 2018, 4:52:58 PM11/21/18
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: 2.1

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------
Changes (by Hasan Ramezani):

* needs_better_patch: 1 => 0


Comment:

I change my PR and manage the widget based on ORDER key in widgets
dictionary. and this feature just works for ModelForm now.

--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:5>

Django

unread,
Feb 13, 2019, 3:17:23 AM2/13/19
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 0 => 1

* version: 2.1 => master


Comment:

On the PR I've suggested a third-option (rather than adding an argument to
`formset_factory()` or using the ModelForm's `Meta.widgets` ) to have
users subclass `BaseFormSet` in this case and pass that as the `formset`
argument to `formset_factory()`.

This keeps the logic in with the formsets but does not expand the
signature of `formset_factory()`, which is already long enough.

--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:6>

Django

unread,
Feb 26, 2019, 8:41:50 AM2/26/19
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------
Changes (by Hasan Ramezani):

* needs_better_patch: 1 => 0


Comment:

I changed the PR based on your suggestion. please check it and let me know
if something else is required.

--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:7>

Django

unread,
Mar 6, 2019, 11:01:32 AM3/6/19
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 0 => 1


Comment:

Small tweaks needed then good to go I think.

--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:8>

Django

unread,
Mar 6, 2019, 2:12:38 PM3/6/19
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------
Changes (by Hasan Ramezani):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:9>

Django

unread,
Mar 6, 2019, 2:12:59 PM3/6/19
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------

Comment (by Hasan Ramezani):

Requested changes are Done.

--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:10>

Django

unread,
Mar 11, 2019, 12:20:44 PM3/11/19
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------
Changes (by Carlton Gibson):

* needs_docs: 0 => 1


Comment:

As per PR, the docs here just need a small amount of work and then this is
looking good to go.

--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:11>

Django

unread,
Mar 17, 2019, 8:11:21 AM3/17/19
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------
Changes (by Hasan Ramezani):

* needs_docs: 1 => 0


Comment:

Docs fixed as your request.

--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:12>

Django

unread,
Mar 21, 2019, 8:18:00 AM3/21/19
to django-...@googlegroups.com
#29956: Allow formset form widget override for the ORDER field
------------------------------+------------------------------------------
Reporter: Claude Paroz | Owner: Hasan Ramezani
Type: New feature | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"5fc5d935120a5d9d428b969ad209695704c10c73" 5fc5d935]:
{{{
#!CommitTicketReference repository=""
revision="5fc5d935120a5d9d428b969ad209695704c10c73"
Fixed #29956 -- Allowed overriding an order field widget in formsets.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29956#comment:13>

Reply all
Reply to author
Forward
0 new messages