diff --git a/jasset/views.py b/jasset/views.py index 1c94a49ee..757c9770c 100644 --- a/jasset/views.py +++ b/jasset/views.py @@ -247,7 +247,6 @@ def list_idc(request): header_title, path1, path2 = u'查看IDC', u'资产管理', u'查看IDC' posts = IDC.objects.all().order_by('id') contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request) - print contact_list, p, contacts, page_range, current_page, show_first, show_end return render_to_response('jasset/idc_list.html', locals(), context_instance=RequestContext(request)) diff --git a/jlog/views.py b/jlog/views.py index 829747184..62a7071a0 100644 --- a/jlog/views.py +++ b/jlog/views.py @@ -20,7 +20,7 @@ def log_list_online(request): header_title, path1, path2 = u'查看日志', u'查看日志', u'在线用户' web_socket_host = CONF.get('websocket', 'web_socket_host') posts = Log.objects.filter(is_finished=0).order_by('-start_time') - contact_list, p, contacts, page_range, current_page = pages(posts, request) + contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request) return render_to_response('jlog/log_online.html', locals()) @@ -29,7 +29,7 @@ def log_list_offline(request): header_title, path1, path2 = u'查看日志', u'查看日志', u'历史记录' web_socket_host = CONF.get('websocket', 'web_socket_host') posts = Log.objects.filter(is_finished=1).order_by('-start_time') - contact_list, p, contacts, page_range, current_page = pages(posts, request) + contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request) return render_to_response('jlog/log_offline.html', locals()) @@ -60,10 +60,10 @@ def log_search(request): if env == 'online': posts = contact_list = Log.objects.filter(Q(user__contains=keyword) | Q(host__contains=keyword)) \ .filter(is_finished=0).order_by('-start_time') - contact_list, p, contacts, page_range, current_page = pages(posts, request) + contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request) elif env == 'offline': posts = contact_list = Log.objects.filter(Q(user__contains=keyword) | Q(host__contains=keyword)) \ .filter(is_finished=1).order_by('-start_time') - contact_list, p, contacts, page_range, current_page = pages(posts, request) + contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request) return render_to_response('jlog/log_search.html', locals()) diff --git a/templates/jasset/group_list.html b/templates/jasset/group_list.html index 3f54241e2..b427266ca 100644 --- a/templates/jasset/group_list.html +++ b/templates/jasset/group_list.html @@ -38,50 +38,7 @@ {% endfor %} -
-
- - -
-
-
-
    - - {% if contacts.has_previous %} - - {% else %} - - {% endif %} - {% ifequal show_first 1 %} -
  • 1...
  • - {% endifequal %} - {% for page in page_range %} - {% ifequal current_page page %} -
  • {{ page }}
  • - {% else %} -
  • {{ page }}
  • - {% endifequal %} - {% endfor %} - {% ifequal show_end 1 %} -
  • ...{{ p.num_pages }}
  • - {% endifequal %} - {% if contacts.has_next %} - - {% else %} - - {% endif %} -
-
-
-
+ {% include 'paginator.html' %} diff --git a/templates/jasset/host_list.html b/templates/jasset/host_list.html index 14a4810d1..4f24879c6 100644 --- a/templates/jasset/host_list.html +++ b/templates/jasset/host_list.html @@ -81,50 +81,7 @@ {% endfor %} -
-
- - -
-
-
-
    - - {% if contacts.has_previous %} - - {% else %} - - {% endif %} - {% ifequal show_first 1 %} -
  • 1...
  • - {% endifequal %} - {% for page in page_range %} - {% ifequal current_page page %} -
  • {{ page }}
  • - {% else %} -
  • {{ page }}
  • - {% endifequal %} - {% endfor %} - {% ifequal show_end 1 %} -
  • ...{{ p.num_pages }}
  • - {% endifequal %} - {% if contacts.has_next %} - - {% else %} - - {% endif %} -
-
-
-
+ {% include 'paginator.html' %} diff --git a/templates/jasset/idc_list.html b/templates/jasset/idc_list.html index 5f0c5dff5..e9c70bc3e 100644 --- a/templates/jasset/idc_list.html +++ b/templates/jasset/idc_list.html @@ -36,50 +36,7 @@ {% endfor %} -
-
- - -
-
-
-
    - - {% if contacts.has_previous %} - - {% else %} - - {% endif %} - {% ifequal show_first 1 %} -
  • 1...
  • - {% endifequal %} - {% for page in page_range %} - {% ifequal current_page page %} -
  • {{ page }}
  • - {% else %} -
  • {{ page }}
  • - {% endifequal %} - {% endfor %} - {% ifequal show_end 1 %} -
  • ...{{ p.num_pages }}
  • - {% endifequal %} - {% if contacts.has_next %} - - {% else %} - - {% endif %} -
-
-
-
+ {% include 'paginator.html' %} diff --git a/templates/jlog/log_offline.html b/templates/jlog/log_offline.html index c2384ff71..abd621ac0 100644 --- a/templates/jlog/log_offline.html +++ b/templates/jlog/log_offline.html @@ -96,30 +96,8 @@ {% endfor %} -
-
-
-
    - - {% if contacts.has_previous %} -
  • «
  • - {% endif %} - - {% for page in p.page_range %} - {% ifequal offset1 page %} -
  • {{ page }}
  • - {% else %} -
  • {{ page }}
  • - {% endifequal %} - {% endfor %} - {% if contacts.has_next %} -
  • »
  • - {% endif %} -
-
-
-
- + {% include 'paginator.html' %} + diff --git a/templates/jlog/log_online.html b/templates/jlog/log_online.html index e925eb19f..582d08433 100644 --- a/templates/jlog/log_online.html +++ b/templates/jlog/log_online.html @@ -96,29 +96,7 @@ {% endfor %} -
-
-
-
    - - {% if contacts.has_previous %} -
  • «
  • - {% endif %} - - {% for page in p.page_range %} - {% ifequal offset1 page %} -
  • {{ page }}
  • - {% else %} -
  • {{ page }}
  • - {% endifequal %} - {% endfor %} - {% if contacts.has_next %} -
  • »
  • - {% endif %} -
-
-
-
+ {% include 'paginator.html' %} diff --git a/templates/paginator.html b/templates/paginator.html new file mode 100644 index 000000000..21455e707 --- /dev/null +++ b/templates/paginator.html @@ -0,0 +1,44 @@ +
+
+ + +
+
+
+
    + + {% if contacts.has_previous %} + + {% else %} + + {% endif %} + {% ifequal show_first 1 %} +
  • 1...
  • + {% endifequal %} + {% for page in page_range %} + {% ifequal current_page page %} +
  • {{ page }}
  • + {% else %} +
  • {{ page }}
  • + {% endifequal %} + {% endfor %} + {% ifequal show_end 1 %} +
  • ...{{ p.num_pages }}
  • + {% endifequal %} + {% if contacts.has_next %} + + {% else %} + + {% endif %} +
+
+
+
\ No newline at end of file