Opened 3 years ago

Last modified 3 years ago

#24472 new New feature

Define internal types explicitly for related fields

Reported by: Andriy Sokolovskiy Owned by: Andriy Sokolovskiy
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

For related fields internal type is not defined explicitly.
For example, if I want to inherit these fields to add some minor changes, I will need to define internal type manually, because some of backend code is related on internal type of the field.

Old pull request - https://github.com/django/django/pull/4002

We discussed here that is a good idea to have this feature in 1.9

Change History (4)

comment:1 Changed 3 years ago by Andriy Sokolovskiy

Has patch: set

comment:2 Changed 3 years ago by Tim Graham

I didn't understand the need to add this. Probably some tests are needed to show the use cases.

comment:3 Changed 3 years ago by Andriy Sokolovskiy

@timgraham, well, it was more suitable for 1.7.x, where we had many places with internal type checks.
At a quick glance in master I found this https://github.com/django/django/blob/a52cd407b86a51e1badf6771e590361e24fd7155/django/db/backends/mysql/schema.py#L61
There may be also places, where are similar checks.
The main goal to give ability for users to not set internal types manually if they need to override one of related fields and give some minor changes.

comment:4 Changed 3 years ago by Tim Graham

Needs tests: set
Triage Stage: UnreviewedAccepted

I guess this is consistent with the other built-in fields. Could you add regression tests?

Note: See TracTickets for help on using tickets.
Back to Top