"""
A generic view for filtering querysets via alphafilter
"""
from django.shortcuts import render_to_response
from django.template import RequestContext
try:
    from django.views.generic import ListView
except ImportError:
    ListView = None

def alphafilter(request, queryset, template):
    """
    Render the template with the filtered queryset
    """
    
    qs_filter = {}
    for key in request.GET.keys():
        if '__istartswith' in key:
            qs_filter[str(key)] = request.GET[key]
            break
    
    return render_to_response(
        template, 
        {'objects': queryset.filter(**qs_filter)}, 
        context_instance=RequestContext(request)
    )

if ListView is not None:
    class AlphafilterListView(ListView):
        def get_queryset(self):
            queryset = super(AlphafilterListView, self).get_queryset()
            
            qs_filter = {}
            for key in self.request.GET.keys():
                if '__istartswith' in key:
                    qs_filter[str(key)] = self.request.GET[key]
                    break
            
            return queryset.filter(**qs_filter)

@@ -744,16 +744,290 @@
 tView):%0A
+        %22%22%22%0A        Generic list view that filters the queryset by the choosen letter.%0A        The template name suffix for this views is _alfalist, so instead%0A        app/model_list.html, use app/model_alfalist.html.%0A        %22%22%22%0A        template_name_suffix = '_alfalist'%0A%0A
         

add doctext and change template_name_suffix to '_alfalist'