Ticket #5609: na2.diff

File na2.diff, 1.9 KB (added by oggie_rob, 7 years ago)

Short version - most changes in trunk

  • django/contrib/admin/options.py

     
    188188            return formfield
    189189
    190190        # For any other type of field, just call its formfield() method.
    191         return db_field.formfield(**kwargs)
     191        formfield = db_field.formfield(**kwargs)
     192        # append name to class
     193        if formfield: # else a non-editable field
     194            attrs = formfield.widget.attrs
     195            field_class = 'v%s' % (formfield.__class__.__name__)
     196            if attrs.get('class'): # prepend to existing classes
     197                field_class += ' %s' % attrs.get('class')
     198            attrs['class'] = field_class
     199        return formfield
    192200
    193201    def _declared_fieldsets(self):
    194202        if self.fieldsets:
  • django/contrib/admin/widgets.py

     
    3737              settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js")
    3838       
    3939    def __init__(self, attrs={}):
    40         super(AdminDateWidget, self).__init__(attrs={'class': 'vDateField', 'size': '10'})
     40        super(AdminDateWidget, self).__init__(attrs={'class': 'vDateField', 'size': '10', 'maxlength': '10'})
    4141
    4242class AdminTimeWidget(forms.TextInput):
    4343    class Media:
     
    4545              settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js")
    4646
    4747    def __init__(self, attrs={}):
    48         super(AdminTimeWidget, self).__init__(attrs={'class': 'vTimeField', 'size': '8'})
     48        super(AdminTimeWidget, self).__init__(attrs={'class': 'vTimeField', 'size': '8', 'maxlength': '8'})
    4949   
    5050class AdminSplitDateTime(forms.SplitDateTimeWidget):
    5151    """
Back to Top