Example #1
0
def highlight(request):
    if 'continent' in request.GET:
        location = request.GET['continent']
    elif 'genre' in request.GET:
        location = request.GET['genre']
    lang = common.db_lang_code(request)
    alaune = Alaune.objects.get(location=location, langue=lang) 
    context = Context({'highlights' : []})
    for i in [2, 3, 4, 1]:
        highlight = alaune.highlights.filter(slide_type=i).latest('creadate')
        context['highlights'].append(HighlightVignette(request, highlight))
    template = loader.get_template('highlight.html')
    response = HttpResponse(template.render(context))
    response['Content-Type'] = 'text/xml'
    return response
Example #2
0
def carousel(request):
    if 'continent' in request.GET:
        location = request.GET['continent']
    elif 'genre' in request.GET:
        location = request.GET['genre']
    lang = common.db_lang_code(request)
    if location in ['999', '10', '20', '30', '50']:
        # Location is Homepage or a continent 
        carousel = Carrousels.objects.get(car_pagecontinent=location, car_langue=lang)
    else:
        # Location is a genre
        carousel = Carrousels.objects.get(car_pagegenre=location, car_langue=lang)
    template = loader.get_template('carousel.html')
    c = build_context(request, carousel)
    response = HttpResponse(template.render(c))
    response['Content-Type'] = 'text/xml'
    return response