def show_by_model(request, object_id):
    system_list = models.UnmanagedSystem.objects.filter(server_model=models.ServerModel.objects.get(id=object_id))
    if 'show_all' in request.GET:
        paginator = Paginator(system_list, system_list.count())                                                                        
    else:
        paginator = Paginator(system_list, 25)                                                                        
                    
    if 'page' in request.GET:
        page = request.GET.get('page')
    else:   
        page = 1
        
    try:
        systems = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        systems = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        systems = paginator.page(paginator.num_pages)
    return render_to_response('user_systems/unmanagedsystem_list.html', {
            'user_system_list': systems,
            'show_all': True,
           },
           RequestContext(request))
dataset/ETHPy150Open mozilla/inventory/user_systems/views.py/show_by_model/original