Reverse related manager should be a manager INSTANCE, not CLASS
|Reported by:||Jonas H.||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.5|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Please see https://github.com/carljm/django-model-utils/issues/31 for a problem description -- "Solution 1" is what this bug is filed for.
What I currently think of is actually pretty simple:
For the descriptor runtime related manager class hackery (this stuff here https://github.com/django/django/blob/d744c550d51955fd623897884446b7f34318e94d/django/db/models/fields/related.py#L484), don't subclass the original manager and then call @super(...)@ in the methods. Instead, make it a totally new class that calls instance methods.
We would probably have to extend the wrappery to replace inheritance. Or do some other type-hackery. (It can probably not get any uglier than it already is ;-)
Change History (4)
comment:1 Changed 4 years ago by
|Patch needs improvement:||unset|
|Summary:||Reverse related manager should be on manager INSTANCE, not CLASS → Reverse related manager should be a manager INSTANCE, not CLASS|