Skip to content

Commit

Permalink
fix: fix _clone method for ModelTranslation support (#1976)
Browse files Browse the repository at this point in the history
ModelTransalation' queryset class `TransalationQuerySet` defines a [`_clone()`](https://github.com/deschler/django-modeltranslation/blob/445ee84821cc8127deee83656a8d3c7ca6f72b54/modeltranslation/manager.py#L188) function that supports passing some kwargs, and some functions already depends on this behaviour (e.g: [`rewrite()`](https://github.com/deschler/django-modeltranslation/blob/445ee84821cc8127deee83656a8d3c7ca6f72b54/modeltranslation/manager.py#L202), [`populate()`](https://github.com/deschler/django-modeltranslation/blob/445ee84821cc8127deee83656a8d3c7ca6f72b54/modeltranslation/manager.py#L206).
This commit restore the support of passing kwargs.
  • Loading branch information
lejenome committed May 27, 2021
1 parent 5259e1f commit e15adba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mezzanine/core/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ def search(self, query, search_fields=None):
queryset = queryset.filter(reduce(ior, optional))
return queryset.distinct()

def _clone(self):
def _clone(self, *args, **kwargs):
"""
Ensure attributes are copied to subsequent queries.
"""
clone = super(SearchableQuerySet, self)._clone()
clone = super(SearchableQuerySet, self)._clone(*args, **kwargs)
clone._search_terms = self._search_terms
clone._search_fields = self._search_fields
clone._search_ordered = self._search_ordered
Expand Down

0 comments on commit e15adba

Please sign in to comment.