Skip to content

Commit

Permalink
Fix polymorphic queryset when saving m2m relation
Browse files Browse the repository at this point in the history
  • Loading branch information
hipek8 committed Sep 23, 2024
1 parent e11a03f commit 4d575b3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ralph/lib/polymorphic/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ def __init__(self, *args, **kwargs):
self._pks_order = None
super().__init__(*args, **kwargs)

def values_list(self, *fields, **kwargs):
flat = kwargs.pop('flat', False)
if flat:
return [getattr(obj, fields[0]) for obj in self[:]]
else:
return super().values_list(*fields, **kwargs)

def _fetch_all(self):
if self._result_cache is not None:
return
Expand Down

0 comments on commit 4d575b3

Please sign in to comment.