Make related_query_name more configurable
|Reported by:||zmsmith||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.4|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
related_query_name makes it difficult it mimic django's default functionality with overridden attribute names.
For example, if I have a model
Foo with a
Bar, but I want
Bar to interact with
Foo as though it's a model named
Fizz there's no way to allow
Bar to have an attribute called
fizz_set and query against the field
I believe this could be implemented easily and be backwards compatible by giving
ManyToManyField additional key word argument
related_query_name that would be passed down to
get_query_name could just check for the existence of this value before returning either
opts.object_name.lower() as it currently does.
Are there any reasons not to do this? I couldn't find any prior discussion in Trac.
Change History (4)
comment:1 Changed 4 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Accepted|