Beispiel #1
0
 def formfield_for_foreignkey(self, db_field, request, **kwargs):
     if db_field.name == 'user':
         if contest_has_participants(request):
             kwargs['queryset'] = User.objects.filter(
                 id__in=Participant.objects.filter(contest=request.contest).
                 values_list('user', flat=True)).order_by('username')
     return super(ParticipantsRoundTimeExtensionMixin,
                  self).formfield_for_foreignkey(db_field, request,
                                                 **kwargs)
Beispiel #2
0
 def formfield_for_foreignkey(self, db_field, request, **kwargs):
     if db_field.name == 'user':
         if contest_has_participants(request):
             kwargs['queryset'] = User.objects \
                 .filter(id__in=Participant.objects
                     .filter(contest=request.contest)
                     .values_list('user', flat=True)) \
                 .order_by('username')
     return super(ParticipantsRoundTimeExtensionMixin, self) \
         .formfield_for_foreignkey(db_field, request, **kwargs)