Skip to content

Commit

Permalink
fix select related
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokant committed Dec 12, 2024
1 parent 8006f3b commit b7a54ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/genlab_bestilling/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ def filter_allowed(self, user):
return self.filter(order__genrequest__project__memberships=user)

def filter_in_draft(self):
return self.select("order").filter(order__status=self.model.OrderStatus.DRAFT)
return self.select_related("order").filter(
order__status=self.model.OrderStatus.DRAFT
)


class SampleQuerySet(models.QuerySet):
def filter_allowed(self, user):
return self.filter(order__genrequest__project__memberships=user)

def filter_in_draft(self):
return self.select("order").filter(order__status=self.model.OrderStatus.DRAFT)
return self.select_related("order").filter(
order__status=self.model.OrderStatus.DRAFT
)

0 comments on commit b7a54ff

Please sign in to comment.