from django.core.urlresolvers import reverse
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.views.generic.list_detail import object_list, object_detail

from builds.models import Build
from builds.filters import BuildFilter
from projects.models import Project

from taggit.models import Tag

def build_list(request, project_slug=None, tag=None):
    """Show a list of builds.
    """
    queryset = Build.objects.all()
    filter = BuildFilter(request.GET, queryset=queryset)

    if tag:
        tag = get_object_or_404(Tag, slug=tag)
        queryset = queryset.filter(project__tags__in=[tag.slug])
    else:
        tag = None

    project = get_object_or_404(Project, slug=project_slug)
    queryset = queryset.filter(project=project)
    active_builds = queryset.exclude(state="finished").values('id')

    return object_list(
        request,
        queryset=queryset,
        extra_context={
            'project': project,
            'filter': filter,
            'tag': tag,
            'active_builds': active_builds
        },
        template_object_name='build',
    )

def build_detail(request, project_slug, pk):
    """Show the details of a particular build.
    """
    project = get_object_or_404(Project, slug=project_slug)
    queryset = Build.objects.filter(project=project)

    return object_detail(
        request,
        queryset=queryset,
        object_id=pk,
        extra_context={'project': project },
        template_object_name='build',
    )

@@ -481,65 +481,8 @@
 ll()
-%0A    filter = BuildFilter(request.GET, queryset=queryset)
 %0A%0A  
@@ -741,16 +741,73 @@
 roject)%0A
+    filter = BuildFilter(request.GET, queryset=queryset)%0A
     acti

Move filter to lower in the Build view.