remove superfluous field options
|Reported by:||David S. <dschein@…>||Owned by:||adrian|
|Component:||Database layer (models, ORM)||Version:||master|
|Severity:||Keywords:||newforms-admin admin fields options validation|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Field options formerly specific to the admin interface (e.g. blank, choices) remain in the newforms-admin branch. The rationale is that they are or could be more generically useful for data validation. This confuses real database constraints like null with these programmatic 'constraints'. Their applicability is ambiguous.
Looking at the 2 examples, both would be better left to whatever app is working with the data. There is nothing inherent in being able to be blank for example, even in the admin. That is, with the new admin.site functionality, it is perfectly reasonable to imagine that you create 2 admin views for the same model, one of which needs a field to be 'blankable' because it fills the value, while a second view permits the value to be manually entered.
Likewise, 2 admin views might want different choices for a particular field. Specifying choices in the model is either too restrictive or just confusing. Of course, it might be that what you really need is choices modeled in the DB as foreign key lookups, but that further obviates the need for choices at the model level.
Removing these kinds of options will simplify and better focus the model interface.