#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 <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/080.a215b92424ea7a3e85f3b74d746b6d90%40djangoproject.com?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to