Django Tutorial - Video 11 - Interactive Facebook Tabs part 2

This tutorial covers building the View and Template to serve the page for the Facebook Tab directly into a Facebook Fan Page.


from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.decorators.csrf import csrf_exempt
from beer.models import Beer

def BeerGifter(request):
        beers = Beer.objects.all().order_by('name')
        context = {'beers': beers}
        return render_to_response('facebooktab/beergifter.html', context, context_instance=RequestContext(request))


<script src="" type="text/javascript"></script>
#fb_header{background: url(/media/images/facebook_header.jpg) no-repeat scroll top center #000000;width:790px;height:200px;}
#fb_beers{background: url(/media/images/beer_wall_bg.jpg) repeat-y top center #000000;width:790px;}
.beer_ul{background: url(/media/images/beer_wall_shelf.png) no-repeat scroll 0 158px transparent;margin:0;padding:0 70px;width:650px;height:300px;list-style:none outside none;}
.beer_ul li{float:left;text-align:center;width:108px;}
.beer_ul li p{color:#DC0000;margin-top:30px;}
<div id="fb_container">
        <div id="fb_header">
                <img src="/media/images/header_logo.png" />
        <div id="fb_beers">
                <ul class="beer_ul">
                {% for beer in beers %}
                        <a href="/beers/{{ beer.slug }}/"><img src="{{ beer.image1.url }}" /></a>
                        <p>{{ }}</p>
                {% if forloop.counter|divisibleby:"6" and not forloop.last %}</ul><ul class="beer_ul">{% endif %}
                {% endfor %}