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
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)
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})
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')
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) })