示例#1
0
文件: views.py 项目: Danfi/pyblog
def articleUnderArchive(request,year,month):
    queryset=articles.objects.filter(publishTime__year=year,publishTime__month=month,type='article').order_by('-publishTime')
    search_fields = ['title']
    return get_datatables_records(
        request,
        queryset,
        search_fields,
        'themes/'+getBlogTheme()+'/archive.html',
        extra_context={
            'year':year,
            'month':month
        }
    )
示例#2
0
文件: views.py 项目: Danfi/pyblog
def getTagList(request, template_name):
    queryset=tags.objects.order_by('-actionLatest')
    search_fields = ['name']
    return get_datatables_records(
        request,
        queryset,
        search_fields,
        template_name,
        extra_context={
            'page_title':_('Tag List'),
            'search_url':reverse('gettaglist'),
            'search_field':_('Tag Name')
        }
    )
示例#3
0
文件: views.py 项目: Danfi/pyblog
def getFileList(request, template_name):
    queryset=blogFiles.objects.order_by('-uploadTime')
    search_fields = ['filename']
    return get_datatables_records(
        request,
        queryset,
        search_fields,
        template_name,
        extra_context={
            'page_title':_('File List'),
            'search_url':reverse('getfilelist'),
            'search_field':_('Filename')
        }
    )
示例#4
0
文件: views.py 项目: Danfi/pyblog
def getCategoryList(request, template_name):
    queryset=categories.objects.all()
    search_fields = ['name','url']
    return get_datatables_records(
        request,
        queryset,
        search_fields,
        template_name,
        extra_context={
            'page_title':_('Category List'),
            'search_url':reverse('getcategorylist'),
            'search_field':_('Category Name')
        }
    )
示例#5
0
文件: views.py 项目: Danfi/pyblog
def getLinkList(request, template_name):
    queryset=links.objects.all()
    search_fields = ['name','url']
    return get_datatables_records(
        request,
        queryset,
        search_fields,
        template_name,
        extra_context={
            'page_title':_('Link List'),
            'search_url':reverse('getlinklist'),
            'search_field':_('Name,Url')
        }
    )
示例#6
0
文件: views.py 项目: Danfi/pyblog
def getPageList(request, template_name):
    queryset=articles.objects.filter(type='page').order_by('-publishTime')
    search_fields = ['title']
    return get_datatables_records(
        request,
        queryset,
        search_fields,
        template_name,
        extra_context={
            'page_title':_('Page List'),
            'search_url':reverse('getpagelist'),
            'search_field':_('Title')
        }
    )
示例#7
0
文件: views.py 项目: Danfi/pyblog
def getCommentList(request, template_name):
    queryset = comments.objects.filter(status="Enabled").order_by("-submitTime")
    search_fields = []
    return get_datatables_records(
        request,
        queryset,
        search_fields,
        template_name,
        extra_context={
            "commentsStatus": commentsStatus,
            "tstatus": _("Status"),
            "page_title": _("Comment List"),
            "search_url": reverse("getcommentlist"),
            "search_field": _("Content"),
        },
    )
示例#8
0
文件: views.py 项目: Danfi/pyblog
def getArticleList(request, template_name):
    queryset=articles.objects.filter(type='article').order_by('-publishTime')
    if request.user.get_user_role() == 'writer':
        queryset = queryset.filter(author=request.user)
    search_fields = ['title']
    return get_datatables_records(
        request,
        queryset,
        search_fields,
        template_name,
        extra_context={
            'page_title':_('Article List'),
            'search_url':reverse('getarticlelist'),
            'search_field':_('Title')
        }
    )
示例#9
0
文件: views.py 项目: Danfi/pyblog
def getUserList(request, template_name):
    queryset=User.objects.all()
    search_fields = ['username','email']
    return get_datatables_records(
        request,
        queryset,
        search_fields,
        template_name,
        extra_context={
            'userRole':userRole,
            'userStatus':userStatus,
            'tstatus':_('Status'),
            'page_title':_('User List'),
            'search_url':reverse('getuserlist'),
            'search_field':_('Username,Email')
        }
    )
示例#10
0
文件: views.py 项目: Danfi/pyblog
def articleUnderTag(request,tslug):
    try:
        ttag = tags.objects.get(name=tslug)
        queryset=articles.objects.filter(tags=ttag,type='article').order_by('-publishTime')
        search_fields = ['title']
        return get_datatables_records(
            request,
            queryset,
            search_fields,
            'themes/'+getBlogTheme()+'/tag.html',
            extra_context={
                'tag':ttag
            }
        )
    except tags.DoesNotExist:
        return render_to_response(
            'themes/'+getBlogTheme()+'/tag.html',
                {'message':_('Tag does not exist.')},
            context_instance=RequestContext(request)
        )
示例#11
0
文件: views.py 项目: Danfi/pyblog
def articleUnderCategory(request,tslug):
        try:
            tcategory = categories.objects.get(slug=tslug)
            queryset=articles.objects.filter(categories=tcategory,type='article').order_by('-publishTime')
            search_fields = ['title']
            return get_datatables_records(
                request,
                queryset,
                search_fields,
                'themes/'+getBlogTheme()+'/category.html',
                extra_context={
                    'category':tcategory
                }
            )
        except categories.DoesNotExist:
            return render_to_response(
                'themes/'+getBlogTheme()+'/category.html',
                    {'message':_('Category does not exist.')},
                context_instance=RequestContext(request)
            )