The `ChangeList` does not support custom queryset subclasses
|Reported by:||jbronn||Owned by:||mtredinnick|
|Severity:||Keywords:||admin changelist queryset custom|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Custom QuerySet classes (like GeoDjango's GeoQuerySet) can't be merged with regular QuerySet objects (using |, & operators). This problem manifests itself when trying to use search fields with a model that uses a QuerySet subclass:
TypeError ... Cannot merge querysets of different types ('GeoQuerySet' and 'QuerySet'.
The root cause is that ChangeList hard-codes using QuerySet for the search fields.
In my patch ChangeList takes advantage of existing information to determine the type of queryset being used and store it in a root_query_set_class attribute that is used when performing searches.
Change History (7)
Changed 6 years ago by jbronn
comment:1 Changed 6 years ago by jbronn
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Summary changed from The `ChangeList` does not support custom queryset classes to The `ChangeList` does not support custom queryset subclasses
comment:2 Changed 6 years ago by brosner
- Triage Stage changed from Unreviewed to Accepted
- Version changed from newforms-admin to SVN