示例#1
0
def get_home_page_files(request, search_tag, search_text):
    if not search_tag and not search_text:
        return recent_files(request, 'all', 10)
    else:
        if search_tag and search_text:
            query = search_tag + " OR " + search_text
        else:
            query = search_tag if search_tag else search_text
        folders = get_allowed_folders(request)
        results_files = SearchQuerySet().filter(
            content=query).filter(folder__in=folders).models(ZornaFile)
        files = []
        for fic in results_files:
            files.append(int(fic.pk))
        files = ZornaFile.objects.filter(pk__in=files)
        return get_files_from_query(request, files)
示例#2
0
文件: views.py 项目: kamni/zorna
def get_home_page_files(request, search_tag, search_text):
    if not search_tag and not search_text:
        return recent_files(request, 'all', 10)
    else:
        return recent_files(request, 'all', 10)
示例#3
0
 def render(self, context):
     request = context['request']
     context[self.var_name] = recent_files(request, self.what, self.limit)
     return ''