Changes between Version 25 and Version 26 of NewformsHOWTO


Ignore:
Timestamp:
03/10/2008 11:39:12 AM (7 years ago)
Author:
brosner
Comment:

#6556 was fixed.

Legend:

Unmodified
Added
Removed
Modified
  • NewformsHOWTO

    v25 v26  
    465465If you want custom validation for a field in the admin '''and''' newforms [http://www.djangoproject.com/documentation/modelforms/ ModelForm] instances you can subclass a field in your model and override ```formfield()```. You can then return the form field you like or a complete [http://www.djangoproject.com/documentation/newforms/#creating-custom-fields custom form field].
    466466
    467 Here we add regex validation to a field (see #6556 for the workaround till the fix is merged to newforms-admin):
     467Here we add regex validation to a field:
    468468
    469469{{{
     
    474474        defaults.update(kwargs)
    475475        return super(models.CharField, self).formfield(form_class=forms.RegexField, **defaults)
    476        
    477     # WORKAROUND to have this field generated by django in the database (see #6556)
    478     def get_internal_type(self):
    479         return "CharField"
    480476
    481477class Event(models.Model):
Back to Top