[Django] #18872: Adding prefix attribute to FormMixin

43 views
Skip to first unread message

Django

unread,
Aug 28, 2012, 6:41:32 PM8/28/12
to django-...@googlegroups.com
#18872: Adding prefix attribute to FormMixin
--------------------------------+------------------------------
Reporter: dragonsnaker@… | Owner: nobody
Type: New feature | Status: new
Component: Generic views | Version: 1.4
Severity: Normal | Keywords: FormMixin prefix
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------+------------------------------
I just want to suggest adding a "prefix" attribute, and its corresponding
get_prefix() method, to the django.views.generix.edit.FormMixin, in order
to make it possible to add a prefix to the form.

I'll attach a patch later, in case my suggestion is considered.

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

Django

unread,
Aug 28, 2012, 6:47:47 PM8/28/12
to django-...@googlegroups.com
#18872: Adding prefix attribute to FormMixin
----------------------------------+--------------------------------------
Reporter: dragonsnaker@… | Owner: nobody
Type: New feature | Status: new
Component: Generic views | Version: 1.4
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by ibustamante):

* cc: ibustamante (added)
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0


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

Django

unread,
Aug 28, 2012, 6:49:13 PM8/28/12
to django-...@googlegroups.com
#18872: Adding prefix attribute to FormMixin
----------------------------------+---------------------------------------
Reporter: dragonsnaker@… | Owner: ibustamante
Type: New feature | Status: assigned
Component: Generic views | Version: 1.4
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by ibustamante):

* owner: nobody => ibustamante
* status: new => assigned


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

Django

unread,
Aug 28, 2012, 7:22:14 PM8/28/12
to django-...@googlegroups.com
#18872: Adding prefix attribute to FormMixin
----------------------------------+---------------------------------------
Reporter: dragonsnaker@… | Owner: ibustamante
Type: New feature | Status: assigned
Component: Generic views | Version: 1.4
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by ibustamante):

* has_patch: 0 => 1


Comment:

Patch added: https://github.com/ibustama/django/tree/ticket_18872

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

Django

unread,
Aug 28, 2012, 7:30:19 PM8/28/12
to django-...@googlegroups.com
#18872: Adding prefix attribute to FormMixin
----------------------------------+---------------------------------------
Reporter: dragonsnaker@… | Owner: ibustamante
Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by ibustamante):

* version: 1.4 => master


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

Django

unread,
Aug 28, 2012, 7:33:35 PM8/28/12
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin

----------------------------------+---------------------------------------
Reporter: dragonsnaker@… | Owner: ibustamante
Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------------+---------------------------------------

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

Django

unread,
Oct 18, 2012, 2:44:48 AM10/18/12
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+---------------------------------------
Reporter: dragonsnaker@… | Owner: ibustamante
Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by lrekucki):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Please submit patches as either diff attachments or links to *pull
request*, which makes them easy to review.

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

Django

unread,
Oct 29, 2012, 3:01:27 PM10/29/12
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+---------------------------------------
Reporter: dragonsnaker@… | Owner: ibustamante
Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+---------------------------------------

Comment (by ibustamante):

Created a pull request to add the patch as requested:
https://github.com/django/django/pull/477

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

Django

unread,
Feb 23, 2013, 6:29:19 AM2/23/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+------------------------------------
Reporter: dragonsnaker@… | Owner: zsiciarz

Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by zsiciarz):

* owner: ibustamante => zsiciarz


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

Django

unread,
Feb 23, 2013, 6:33:32 AM2/23/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+------------------------------------
Reporter: dragonsnaker@… | Owner: zsiciarz
Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1

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

* needs_docs: 0 => 1


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

Django

unread,
Feb 23, 2013, 6:55:43 AM2/23/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+------------------------------------
Reporter: dragonsnaker@… | Owner: zsiciarz
Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+------------------------------------

Comment (by zsiciarz):

Well, just a thought: prefixes are used to discriminate between multiple
forms within the same view. Since the FormMixin handles only one form,
what's the use case for setting a custom prefix for that form?

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

Django

unread,
Feb 23, 2013, 2:22:17 PM2/23/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+------------------------------------
Reporter: dragonsnaker@… | Owner: zsiciarz
Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+------------------------------------

Comment (by konradhalas):

Yes, but you can always create two (and more) '''different''' forms within
one page and with prefix field you can avoid inputs name collision.

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

Django

unread,
Feb 25, 2013, 3:08:53 PM2/25/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+------------------------------------
Reporter: dragonsnaker@… | Owner: zsiciarz
Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+------------------------------------

Comment (by ibustamante):

I want to reinforce what @konradhalas said. It's possible to have multiple
forms on the same page when you're using AJAX, for example. In this case
you would need to have a prefix set, so as to avoid input id collision.

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

Django

unread,
Apr 12, 2013, 3:40:06 PM4/12/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+------------------------------------
Reporter: dragonsnaker@… | Owner: zsiciarz
Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+------------------------------------

Comment (by druidjaidan):

Have to agree. There are lots of reasons you might need to use a prefix
that don't involve processing more than one form. I ran into this because
we had a form on the page that acted as a context switcher, changing it's
value caused the form to be processed, changed a session value, and
reloaded the page given the new context. This caused an id collision
anytime the user was on a page that happened to have a form that had the
same field name (really common considering the context was a FK).

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

Django

unread,
May 10, 2013, 4:27:05 PM5/10/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+------------------------------------
Reporter: dragonsnaker@… | Owner: EvilDMP

Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by EvilDMP):

* owner: zsiciarz => EvilDMP


Comment:

I have tentatively reserved this ticket for first-time committers who take
part in the [https://dont-be-afraid-to-commit.readthedocs.org/ Don't be
afraid to commit workshop] at the [http://2013.djangocon.eu/ DjangoCon
Europe 2013] sprints on 18th and 19th May.

If you want to tackle this ticket before then, please '''don't''' let the
fact that it's assigned to me stop you. Feel free to re-assign it to
yourself and do whatever you like to it.

'''Note''' - the pull request https://github.com/django/django/pull/477
for this one has been closed because "it needs docs and tests". You know
what to do...

--
Ticket URL: <https://code.djangoproject.com/ticket/18872#comment:14>

Django

unread,
May 30, 2013, 7:51:37 PM5/30/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+-------------------------------------
Reporter: dragonsnaker@… | Owner: anonymous

Type: New feature | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+-------------------------------------
Changes (by alasdair):

* owner: EvilDMP => anonymous


Comment:

Grabbing the ticket. I aim to add docs and tests by the end of the weekend
June 1-2.

Is there any reason why we shouldn't always include the prefix in the form
kwargs?

{{{
#!py
def get_form_kwargs(self):
"""
Returns the keyword arguments for instantiating the form.
"""
kwargs = {'initial': self.get_initial(),
'prefix': self.get_prefix(),
}
}}}

There shouldn't be any problems doing this, because the default
`prefix=None` matches the default `prefix=None` in the form class. Always
including prefix makes it easier to describe in the get_form_kwargs docs
("the prefix argument is set to get_prefix" than in the initial pull
request, where prefix is only included if it evaluates to True.

--
Ticket URL: <https://code.djangoproject.com/ticket/18872#comment:15>

Django

unread,
Jun 22, 2013, 7:19:33 AM6/22/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+-------------------------------------
Reporter: dragonsnaker@… | Owner: anonymous
Type: New feature | Status: closed

Component: Generic views | Version: master
Severity: Normal | Resolution: fixed

Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+-------------------------------------
Changes (by Gilberto Gonçalves <lursty@…>):

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


Comment:

In [changeset:"ef37b23050637da643b47b1ee744702d4d603f4c"]:
{{{
#!CommitTicketReference repository=""
revision="ef37b23050637da643b47b1ee744702d4d603f4c"
Fixed #18872 -- Added prefix to FormMixin

Thanks @ibustama for the initial patch and dragonsnaker for opening the
report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/18872#comment:16>

Django

unread,
Jun 22, 2013, 7:19:34 AM6/22/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+-------------------------------------
Reporter: dragonsnaker@… | Owner: anonymous
Type: New feature | Status: closed
Component: Generic views | Version: master
Severity: Normal | Resolution: fixed
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+-------------------------------------

Comment (by Marc Tamlyn <marc.tamlyn@…>):

In [changeset:"257a137c430cd325f3deeda8daffbf03a3cb20fd"]:
{{{
#!CommitTicketReference repository=""
revision="257a137c430cd325f3deeda8daffbf03a3cb20fd"
Merge pull request #1294 from LuRsT/added_prefix_to_form_mixin

Fixed #18872 -- Added prefix to FormMixin
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/18872#comment:17>

Django

unread,
Jun 24, 2013, 3:11:30 PM6/24/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+-------------------------------------
Reporter: dragonsnaker@… | Owner: anonymous
Type: New feature | Status: closed
Component: Generic views | Version: master
Severity: Normal | Resolution: fixed
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+-------------------------------------

Comment (by timo):

In the release notes, this was added under "Backwards incompatible
changes". I believe it should be under "Minor features" instead?

--
Ticket URL: <https://code.djangoproject.com/ticket/18872#comment:18>

Django

unread,
Jun 25, 2013, 7:51:55 AM6/25/13
to django-...@googlegroups.com
#18872: Add prefix attribute to FormMixin
----------------------------------+-------------------------------------
Reporter: dragonsnaker@… | Owner: anonymous
Type: New feature | Status: closed
Component: Generic views | Version: master
Severity: Normal | Resolution: fixed
Keywords: FormMixin prefix | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"e10757ff4dbbc1aedd09df6c542948409c49d75f"]:
{{{
#!CommitTicketReference repository=""
revision="e10757ff4dbbc1aedd09df6c542948409c49d75f"
Doc cleanup for FormMixin.prefix; refs #18872.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/18872#comment:19>

Reply all
Reply to author
Forward
0 new messages