Esempio n. 1
0
def show(request, project, slug, phase, template_name='challenges/show.html',
         category=False):
    """Show an individual project challenge."""
    try:
        challenge = (Challenge.objects.select_related('project')
                     .get(project__slug=project, slug=slug))
    except Challenge.DoesNotExist:
        raise Http404
    project = challenge.project
    """Pagination options """
    entry_set = Submission.objects.visible(request.user)
    entry_set = entry_set.filter(phase__challenge=challenge, phase=phase)
    if category:
        entry_set = entry_set.filter(category__slug=category)
    page_number = get_page(request.GET)
    entries = get_paginator(entry_set, page_number, 6)
    try:
        category = Category.objects.get(slug=category)
    except ObjectDoesNotExist:
        category = False
    return jingo.render(request, template_name, {
        'challenge': challenge,
        'project': project,
        'phases': list(enumerate(challenge.phases.all(), start=1)),
        'entries': entries,
        'categories': Category.objects.get_active_categories(),
        'category': category,
        'days_remaining': phase.days_remaining,
        'phase': phase,
    })
Esempio n. 2
0
def show(request, project, slug, phase, template_name='challenges/show.html',
         category=False):
    """Show an individual project challenge."""
    try:
        challenge = (Challenge.objects.select_related('project')
                     .get(project__slug=project, slug=slug))
    except Challenge.DoesNotExist:
        raise Http404
    project = challenge.project
    """Pagination options """
    entry_set = Submission.objects.visible(request.user)
    entry_set = entry_set.filter(phase__challenge=challenge, phase=phase)
    if category:
        entry_set = entry_set.filter(category__slug=category)
    page_number = get_page(request.GET)
    entries = get_paginator(entry_set, page_number, 6)
    try:
        category = Category.objects.get(slug=category)
    except ObjectDoesNotExist:
        category = False
    return jingo.render(request, template_name, {
        'challenge': challenge,
        'project': project,
        'phases': list(enumerate(challenge.phases.all(), start=1)),
        'entries': entries,
        'categories': Category.objects.get_active_categories(),
        'category': category,
        'days_remaining': phase.days_remaining,
        'phase': phase,
    })
Esempio n. 3
0
def entry_help_list(request, project, challenge):
    """Lists all the ``Submissions`` that need help"""
    object_list = SubmissionHelp.objects.get_active()
    page_number = get_page(request.GET)
    paginated_query = get_paginator(object_list, page_number)
    context = {'page': paginated_query}
    return jingo.render(request, 'challenges/submission_help_list.html',
                        context)
Esempio n. 4
0
def entry_help_list(request, project, challenge):
    """Lists all the ``Submissions`` that need help"""
    object_list = SubmissionHelp.objects.get_active()
    page_number = get_page(request.GET)
    paginated_query = get_paginator(object_list, page_number)
    context = {'page': paginated_query}
    return jingo.render(request, 'challenges/submission_help_list.html',
                        context)
Esempio n. 5
0
def object_list(request, entry, release, template='timeslot/object_list.html'):
    """Listing of the ``TimeSlots`` available for a given entry"""
    # Book timeslots start at least 24 hours in advance
    start_date = datetime.utcnow() + timedelta(hours=24)
    timeslot_qs = TimeSlot.objects.filter(start_date__gte=start_date,
                                          release=release, is_booked=False)
    page_number = get_page(request.GET)
    page = get_paginator(timeslot_qs, page_number)
    context = {
        'page': page,
        'entry': entry,
        }
    return jingo.render(request, template, context)
def object_list(request, entry, release, template='timeslot/object_list.html'):
    """Listing of the ``TimeSlots`` available for a given entry"""
    # Book timeslots start at least 24 hours in advance
    start_date = datetime.utcnow() + timedelta(hours=24)
    timeslot_qs = TimeSlot.objects.filter(start_date__gte=start_date,
                                          release=release,
                                          is_booked=False)
    page_number = get_page(request.GET)
    page = get_paginator(timeslot_qs, page_number)
    context = {
        'page': page,
        'entry': entry,
    }
    return jingo.render(request, template, context)