Exemplo n.º 1
0
def new_bar(request):
    if 'new' in request.GET:
        bar = Bar()
        bar.save()
        return HttpResponseRedirect(reverse('faith:new'))

    return render_to_response('faith/new.html', {},
        context_instance=RequestContext(request))
Exemplo n.º 2
0
def main(request):
    try:
        bar = Bar.objects.latest("date_created")
    except Bar.DoesNotExist:
        bar = Bar()
        bar.save()

    has_voted = bar.has_voted(request.META["REMOTE_ADDR"])

    return render_to_response(
        "index.html", {"has_voted": has_voted, "bar": bar}, context_instance=RequestContext(request)
    )
Exemplo n.º 3
0
def track(request):
    try:
        bar = Bar.objects.latest('date_created')
    except Bar.DoesNotExist:
        bar = Bar()
        bar.save()

    has_voted = bar.has_voted(request.META['REMOTE_ADDR'])

    return render_to_response('faith/track.html', {
            'has_voted': has_voted,
            'bar': bar,
        }, context_instance=RequestContext(request))