Inconsistent get_internal_type on official models' fields
|Reported by:||Mitar||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I think there is a small inconsistency on when does
get_internal_type return base type and when it defines as a new type in official models' fields.
I wanted to make a dynamic list of searchable fields (
search_fields) in admin by inspecting all defined fields in a model and adding all those which have
get_internal_type defined as
TextField (and ignoring those which define choices, but this is not important here). This works great on
URLField among official models' fields. But there is a strange situation with
CommaSeparatedIntegerField. The first defines new type (named
SlugField) which is OK by me if we say that it changes semantics somewhat. But then why
CommaSeparatedIntegerField does not define new type but leave it as
CharField where this field is definitely something special.
I would suggest
CharField and that
CommaSeparatedIntegerField. Or to do at least just the later.