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) )
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))