Changes between Initial Version and Version 1 of Ticket #20465, comment 1


Ignore:
Timestamp:
May 22, 2013, 11:12:58 PM (11 years ago)
Author:
Simon Meers

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20465, comment 1

    initial v1  
    1 As stated the [https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_overrides / docs], `formfield_overrides` "provides a quick-and-dirty way to override some of the Field options for use in the admin". If you want to do something more complicated than a simple per-field-class override, you should look into overriding `ModelAdmin.formfield_for_dbfield`. Whilst not overly elegant, it will allow you to completely customise the form fields based on whatever properties you like without "overriding the `ModelForm`". You may also be interested in [https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_choice_field / ModelAdmin.formfield_for_choice_field] in this instance.
     1As stated in the [https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_overrides / docs], `formfield_overrides` "provides a quick-and-dirty way to override some of the Field options for use in the admin". If you want to do something more complicated than a simple per-field-class override, you should look into overriding `ModelAdmin.formfield_for_dbfield`. Whilst not overly elegant, it will allow you to completely customise the form fields based on whatever properties you like without "overriding the `ModelForm`". You may also be interested in [https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_choice_field / ModelAdmin.formfield_for_choice_field] in this instance.
    22
    33Feel free to propose details of a more elegant solution, though please bear in mind backwards-compatibility concerns. You may also find the details and outcome of #17924 relevant, involving a similar proposal for `ModelForm`s in general.
Back to Top