直接上代码吧:
十多年建站经验, 成都网站建设、成都网站制作客户的见证与正确选择。创新互联公司提供完善的营销型网页建站明细报价表。后期开发更加便捷高效,我们致力于追求更美、更快、更规范。# views.py def accesslog(request): state = login_status(request.user.is_authenticated()) log_list = AccessLog.objects.all().order_by() paginator = Paginator(log_list, 10) current_page_num = request.GET.get('page', 1) try: current_page = paginator.page(current_page_num) except EmptyPage: current_page = paginator.page(paginator.num_pages) except PageNotAnInteger: current_page = paginator.page(1) return render(request, 'radius/accesslog.html', { 'current_page': current_page, 'paginator': paginator, 'state': state }) # templatetags/mytag.py from django import template register = template.Library() @register.filter(name='substra') def substra(value, arg): try: return int(value) - int(arg) except: return ''
HTML
# accesslog.html {% load mytag %}{% for log in current_page.object_list %}
{% endfor %} {{ log.id }} {{ log.username }} {{ log.ipaddr }} {{ log.access_datetime|date:"Y-m-d H:s" }} {% if log.status %}认证成功 {% else %}认证失败 {% endif %}{{ log.message }}
创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。