示例#1
0
def _csrf_failure(request, reason=""):
    if is_admin_session(request):
        update_admin_session(request)
        response = render(
            request, 'misago/admin/errorpages/csrf_failure_authenticated.html',
            error_page=True)
    else:
        response = render(request, 'misago/admin/errorpages/csrf_failure.html')

    response.status_code = 403
    return response
示例#2
0
    def render(self, request, context=None, template=None):
        context = context or {}

        context['root_link'] = self.root_link
        context['current_link'] = self.current_link(request)

        context = self.process_context(request, context)

        template = template or self.final_template()
        return render(request, template, context)
示例#3
0
文件: index.py 项目: sun5495/Misago
def admin_index(request):
    inactive_users = {"requires_activation__gt": ACTIVATION_REQUIRED_NONE}
    db_stats = {
        "threads": Thread.objects.count(),
        "posts": Post.objects.count(),
        "users": User.objects.count(),
        "inactive_users": User.objects.filter(**inactive_users),
    }

    return render(request, "misago/admin/index.html", {"db_stats": db_stats})
示例#4
0
def _error_page(request, code, message=None):
    if is_admin_session(request):
        template_pattern = 'misago/admin/errorpages/%s.html' % code

        response = render(request,
                          template_pattern,
                          {'message': message},
                          error_page=True)
        response.status_code = code
        return response
    else:
        return redirect('misago:admin:index')
示例#5
0
文件: index.py 项目: vfoss-org/Misago
def admin_index(request):
    inactive_users = {'requires_activation__gt': ACTIVATION_REQUIRED_NONE}
    db_stats = {
        'threads': Thread.objects.count(),
        'posts': Post.objects.count(),
        'users': User.objects.count(),
        'inactive_users': User.objects.filter(**inactive_users)
    }

    return render(request, 'misago/admin/index.html', {
        'db_stats': db_stats,
        'version_check': cache.get(VERSION_CHECK_CACHE_KEY)
    })