Commit 4bba12a2 authored by Håvard Farestveit's avatar Håvard Farestveit
Browse files

Changed methods to be static

parent a259d446
Pipeline #125664 passed with stage
in 29 seconds
......@@ -95,13 +95,15 @@ class OfferList(
def perform_create(self, serializer):
serializer.save(owner=self.request.user)
def filter_on_status(self, query_set, query_params, user):
@staticmethod
def filter_on_status(query_set, query_params):
status = query_params.get("status", None)
if status is not None and self.request is not None:
if status is not None:
query_set = query_set.filter(status=status)
return query_set
def filter_on_category(self, query_set, query_params, user):
@staticmethod
def filter_on_category(query_set, query_params, user):
category = query_params.get("category", None)
if category is not None and query_params is not None:
if category == "sent":
......@@ -120,7 +122,7 @@ class OfferList(
query_params = self.request.query_params
user = self.request.user
query_set = self.filter_on_status(query_set, query_params, user)
query_set = self.filter_on_status(query_set, query_params)
query_set = self.filter_on_category(query_set, query_params, user)
return query_set
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment