Allow Fields to use multiple db columns (complex datatypes)
|Reported by:||poelzi||Owned by:|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||Anossov, artagnon, volrath, jamesturk, glassreistor, ben.coughlan@…, ognajd@…, j.arnds@…, carlos.palol@…, cmawebsite@…||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently it seems that it is not possible to have complex db filds. For example:
Implementation of a IP model which actually should be a field type not a model. The implementation is not clean, because foreign key lookups for example do not work. The model maps for example:
into a complex query for a ip resisting in a network range.
Due the fact that model fields can only map to one db column, many complex data types can't be implemented. For example a ipv6 ip address which is a 128 bit value can't be handled by most db implementations of integer fields, so it has to be expanded to multiple columns plus a additional netmask column. Using varchar doesn't work because there is no way to search for network ranges or IPs in ranges, etc...
I think a field should be able to implement lookup mappings which can be overridden to implement complex datatypes as well as use multiple db fields.
Change History (25)
comment:1 Changed 9 years ago by Jim Meier <jim-django@…>
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 9 years ago by poelzi
- Triage Stage changed from Unreviewed to Design decision needed
comment:6 Changed 8 years ago by gonz
- Cc gonz added
- Owner changed from nobody to gonz
- Status changed from new to assigned