Beispiel #1
0
def show_event(request, permalink, ajax=None):
    event = get_object_or_404(Event,permalink = permalink)
    nominated = Nominated.objects.with_rates(event)
    for n in nominated:
        if n.film_id:
            n.film = Film.get(id=n.film_id)
        if n.person_id:
            n.person = Person.get(id=n.person_id)
    categories = []
    for type, items in groupby(nominated, lambda n: n.oscar_type):
        items = list(items)
        if event.event_status == Event.STATUS_OPEN:
            shuffle(list(items))
        if items:
            categories.append({
                'name': items[0].get_category_name(),
                'nominated': items,
            })

    ctx = {
        'event': event,
        'categories': categories,
    }

    return render_to_response('event/event.html', ctx, context_instance=RequestContext(request))
Beispiel #2
0
def show_event(request, permalink, ajax=None):
    event = get_object_or_404(Event, permalink=permalink)
    nominated = Nominated.objects.with_rates(event)
    for n in nominated:
        if n.film_id:
            n.film = Film.get(id=n.film_id)
        if n.person_id:
            n.person = Person.get(id=n.person_id)
    categories = []
    for type, items in groupby(nominated, lambda n: n.oscar_type):
        items = list(items)
        if event.event_status == Event.STATUS_OPEN:
            shuffle(list(items))
        if items:
            categories.append({
                'name': items[0].get_category_name(),
                'nominated': items,
            })

    ctx = {
        'event': event,
        'categories': categories,
    }

    return render_to_response('event/event.html',
                              ctx,
                              context_instance=RequestContext(request))