#13546: Easier handling of localize field options in ModelForm
-------------------------------+--------------------------------------------
          Reporter:  hsk       |         Owner:  nobody
            Status:  new       |     Milestone:        
         Component:  Forms     |       Version:  SVN   
        Resolution:            |      Keywords:        
             Stage:  Accepted  |     Has_patch:  0     
        Needs_docs:  0         |   Needs_tests:  0     
Needs_better_patch:  0         |  
-------------------------------+--------------------------------------------
Changes (by russellm):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * summary:  Feature request: USE_L10N as default value for form Field =>
              Easier handling of localize field options in
              ModelForm
  * needs_docs:  => 0
  * has_patch:  1 => 0
  * stage:  Unreviewed => Accepted

Comment:

 The localize argument was added in [12867] as a solution for #13032. This
 bug covered a number of common use cases where enabling L10N by default
 wouldn't be a good idea (in particular, AutoFields, and IntegerFields
 storing dates, postal codes, and other non-comma-separated data). So, the
 idea as proposed won't be accepted.

 However, I can accept the problem use case of making it easier to
 propagate the localize setting into fields on a ModelForm. I would suggest
 that a better approach would be to allow ModelForm Meta options to control
 the fields that are localized. For example:

 {{{
 class MyForm(forms.ModelForm):
     class Meta:
         model = SomeModel
         localized_fields = ('some_field', 'other_field')
 }}}

 There would also be a need for an exclude-based specification:
 {{{
 class MyForm(forms.ModelForm):
     class Meta:
         model = SomeModel
         localized_excludes = ('current_year', 'postcode')
 }}}

 There is a case to consider for how localized_fields and
 localized_excludes would interact -- I suspect the analog with
 fields/excludes would be suitable.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13546#comment:1>
Django <http://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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to