#9245: django.db.models.fields.Field forces use of TypedChoiceField
------------------------------------------+---------------------------------
 Reporter:  Tarken                        |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  1.0       
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 For most field types, I can override the class used to display the field
 with:
 {{{
 #!python
 def formfield(self, **kwargs):
     defaults = {'form_class': CustomFormField}
     defaults.update(kwargs)
     return super(MyFieldClass, self).formfield(**defaults)
 }}}
 However, the Field class specifically overrides this when the field has
 'choices'.
 Lines 311-326 of django/db/models/fields/__init__.py contain the offending
 code. The specific override is on line 318:
 {{{
 #!python
 form_class = forms.TypedChoiceField
 }}}
 In my case, I have a subclass of TypedChoiceField which I would like to
 use to display the field. Instead of the simple bit of code shown above,
 however, I had to duplicate the entire formfield function from the base
 Field class, and change that one offending line.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9245>
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to