Пример #1
0
 def get_user_public_name(self, request, user):
     assert self.contest == request.contest
     if request.user.is_superuser or can_see_personal_data(request) \
             or user not in anonymous_participants(request):
         return get_user_display_name(user)
     else:
         return user.username
Пример #2
0
 def get_user_public_name(self, request, user):
     assert self.contest == request.contest
     if request.user.is_superuser or can_see_personal_data(request) \
             or not user in anonymous_participants(request):
         return get_user_display_name(user)
     else:
         return user.username
Пример #3
0
    def get_contest_participant_info_list(self, request, user):
        prev = super(OIRegistrationController, self).get_contest_participant_info_list(request, user)

        if can_see_personal_data(request):
            sensitive_info = OIRegistration.objects.filter(participant__user=user, participant__contest=request.contest)
            if sensitive_info.exists():
                context = {"model": sensitive_info[0]}
                rendered_sensitive_info = render_to_string(
                    "oi/sensitive_participant_info.html", context_instance=RequestContext(request, context)
                )
                prev.append((2, rendered_sensitive_info))

        return prev
Пример #4
0
    def get_contest_participant_info_list(self, request, user):
        prev = super(OIRegistrationController, self) \
                .get_contest_participant_info_list(request, user)

        if can_see_personal_data(request):
            sensitive_info = OIRegistration.objects.filter(
                participant__user=user, participant__contest=request.contest)
            if sensitive_info.exists():
                context = {'model': sensitive_info[0]}
                rendered_sensitive_info = render_to_string(
                    'oi/sensitive_participant_info.html',
                    context_instance=RequestContext(request, context))
                prev.append((2, rendered_sensitive_info))

        return prev
Пример #5
0
    def render(self, context):
        is_admin = is_contest_admin(context['request'])
        personal_data = can_see_personal_data(context['request'])
        url = render_to_string('contests/user_info_link.html', {
                'ctx': context,
                'target_user': self.target_user.resolve(context),
                'target_name': self._get_user_name(context, self.target_user
                        .resolve(context)),
                'is_admin': is_admin,
                'can_see_personal_data': personal_data
        })

        if self.asvar:
            context[self.asvar] = url
            return ''
        else:
            return url
Пример #6
0
    def render(self, context):
        is_admin = context.get('is_admin', False) or \
            is_contest_admin(context['request'])
        personal_data = can_see_personal_data(context['request'])
        url = render_to_string('contests/user_info_link.html', {
                'ctx': context,
                'target_user': self.target_user.resolve(context),
                'target_name': self._get_user_name(context, self.target_user
                        .resolve(context)),
                'is_admin': is_admin,
                'can_see_personal_data': personal_data
        })

        if self.asvar:
            context[self.asvar] = url
            return ''
        else:
            return url