예제 #1
0
 def __init__(self, *args, **kwargs):
     super(ChallengeSerializer, self).__init__(*args, **kwargs)
     context = kwargs.get("context")
     if context and context.get("request").method != "GET":
         challenge_host_team = context.get("challenge_host_team")
         kwargs["data"]["creator"] = challenge_host_team.pk
     else:
         self.fields["creator"] = ChallengeHostTeamSerializer()
예제 #2
0
 def __init__(self, *args, **kwargs):
     super(ChallengeSerializer, self).__init__(*args, **kwargs)
     context = kwargs.get('context')
     if context and context.get('request').method != 'GET':
         challenge_host_team = context.get('challenge_host_team')
         kwargs['data']['creator'] = challenge_host_team.pk
     else:
         self.fields['creator'] = ChallengeHostTeamSerializer()