更改过滤标签

pull/2/head
ibuler 2014-11-02 23:11:44 +08:00
parent aa9139c642
commit a57adf9b2e
4 changed files with 4 additions and 2 deletions

View File

@ -957,7 +957,7 @@ def downFile(request):
@admin_required @admin_required
def logView(request): def logView(request):
thirtyDayAgo = (datetime.datetime.now() - datetime.timedelta(30)) thirtyDayAgo = (datetime.datetime.now() - datetime.timedelta(30))
thirtyDayAgoStamp = int(thirtyDayAgo.timetuple()) thirtyDayAgoStamp = int(time.mktime(thirtyDayAgo.timetuple()))
logs_all = Logs.objects.filter(start_time__gt=thirtyDayAgoStamp) logs_all = Logs.objects.filter(start_time__gt=thirtyDayAgoStamp)
paginator = Paginator(logs_all, 20) paginator = Paginator(logs_all, 20)

View File

@ -1,4 +1,6 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load mytags %}
{% block content %} {% block content %}
<form method="post" action=""> <form method="post" action="">
<table class="table table-striped table-hover table-condensed"> <table class="table table-striped table-hover table-condensed">

View File

View File

@ -4,7 +4,7 @@ from django import template
register = template.Library register = template.Library
@register.filter('stamp2str') @register.filter(name='stamp2str')
def stamp2str(value): def stamp2str(value):
try: try:
return time.strftime('%Y/%m/%d %H:%M:%S',time.localtime(value)) return time.strftime('%Y/%m/%d %H:%M:%S',time.localtime(value))