fix
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from django.db import transaction
|
||||
from django.db.models import Q
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
@@ -133,8 +134,9 @@ class OrderListForOfferSerializer(serializers.ModelSerializer):
|
||||
|
||||
def get_offers(self, obj):
|
||||
status = self.context.get('status')
|
||||
search = self.context.get('search')
|
||||
if status:
|
||||
offers = obj.offers.filter(status=status)
|
||||
return OffersSerializer(offers, many=True).data
|
||||
else:
|
||||
return OffersSerializer(obj.offers, many=True).data
|
||||
if search:
|
||||
offers = obj.offers.filter(Q(number__istartswith=search) | Q(comment__istartswith=search))
|
||||
return OffersSerializer(offers, many=True).data
|
||||
Reference in New Issue
Block a user