(request)
return render_to_response('form_gallery.html', context_instance=context)
Return a list of urls for all the shared xls files. This could be
    made a lot prettier.
Return a list of urls for all the shared xls files. This could be
    made a lot prettier.
Return a list of urls for all the shared xls files . This could be made a lot prettier .
def form_gallery(request):
    """
    Return a list of urls for all the shared xls files. This could be
    made a lot prettier.
    """
    context = RequestContext(request)
    if request.user.is_authenticated():
        context.loggedin_user = request.user
    context.shared_forms = XForm.objects.filter(shared=True)
    # build list of shared forms with cloned suffix
    id_strings_with_cloned_suffix = [
        x.id_string + XForm.CLONED_SUFFIX for x in context.shared_forms
    ]
    # build list of id_strings for forms this user has cloned
    context.cloned = [
        x.id_string.split(XForm.CLONED_SUFFIX)[0]
        for x in XForm.objects.filter(
            user__username=request.user.username,
            id_string__in=id_strings_with_cloned_suffix
        )
    ]
    return render_to_response('form_gallery.html', context_instance=context)
def form_gallery ( request ) : context = RequestContext ( request ) if request . user . is_authenticated ( ) : context . loggedin_user = request . user context . shared_forms = XForm . objects . filter ( shared = True ) # build list of shared forms with cloned suffix id_strings_with_cloned_suffix = [ x . id_string + XForm . CLONED_SUFFIX for x in context . shared_forms ] # build list of id_strings for forms this user has cloned context . cloned = [ x . id_string . split ( XForm . CLONED_SUFFIX ) [ 0 ] for x in XForm . objects . filter ( user__username = request . user . username , id_string__in = id_strings_with_cloned_suffix ) ] return render_to_response ( 'form_gallery.html' , context_instance = context )