예제 #1
0
    def ddzone_generator():
        # show drag and drop zone only for contest with submitting some files
        if (not hasattr(request, 'contest')
                or not hasattr(request.contest, 'controller')
                or not isinstance(request.contest.controller,
                                  ProgrammingContestController)):
            return ''
        # do not show drag and drop zone when no available problems
        # (the following require controller in request)
        if (not has_any_submittable_problem(request)
                or not contest_exists(request)
                or not can_enter_contest(request)
                or getattr(request, 'hide_drag_and_drop', False)):
            return ''

        c = {'contest_id': request.contest.id}
        c.update(csrf(request))
        return render_to_string('programs/drag_and_drop.html', c)
예제 #2
0
    def ddzone_generator():
        # show drag and drop zone only for contest with submitting some files
        if not hasattr(request, 'contest') or \
                not hasattr(request.contest, 'controller') or \
                not isinstance(request.contest.controller,
                               ProgrammingContestController):
            return ''
        # do not show drag and drop zone when no available problems
        # (the following require controller in request)
        if not has_any_submittable_problem(request) \
                or not contest_exists(request) \
                or not can_enter_contest(request) \
                or getattr(request, 'hide_drag_and_drop', False):
            return ''

        c = {'contest_id': request.contest.id}
        c.update(csrf(request))
        return render_to_string('programs/drag_and_drop.html', c)