Add votes to SubmissionType
+import graphene
from graphene_django import DjangoObjectType
+from voting.types import VoteType
+
from .models import Submission
from .models import SubmissionType as ModelSubmissionType
@@ -11,6 +14,11 @@ class SubmissionTypeType(DjangoObjectType):
class SubmissionType(DjangoObjectType):
+ votes = graphene.NonNull(graphene.List(graphene.NonNull(VoteType)))
+
+ def resolve_votes(self, info):
+ return self.votes.all()
+
class Meta:
model = Submission
only_fields = (
@@ -25,4 +33,5 @@ class SubmissionType(DjangoObjectType):
"topic",
"type",
"duration",
+ "votes",
)
