Fakultas Ilmu Komputer UI

Commit fd19d39d authored by Naufal Alauddin Hilmi's avatar Naufal Alauddin Hilmi
Browse files

[GREEN] create query for filter and get mustahik

parent c5737f80
import graphene
from django.db.models import Q
from .models import Mustahik
from .types import MustahikType
class MustahikQuery(graphene.ObjectType):
mustahiks = graphene.List(MustahikType, statuses=graphene.List(graphene.String))
def resolve_mustahiks(self, info, statuses=[], **kwargs):
if statuses and len(statuses) > 0:
filter = Q(status=statuses[0])
for status in statuses:
filter = filter | Q(status=status)
return Mustahik.objects.filter(filter)
return Mustahik.objects.all()
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