From 3903eedc1af3bc9eec65b1ec256c31c7c8be7164 Mon Sep 17 00:00:00 2001 From: guanghongwei Date: Sat, 24 Jan 2015 16:27:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B1=9E=E7=BB=84=E6=8E=88?= =?UTF-8?q?=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jperm/views.py | 8 +++-- templates/jperm/perm_host.html | 63 +++++++++++++++++++++++++++++++--- 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/jperm/views.py b/jperm/views.py index 369761008..559b002a1 100644 --- a/jperm/views.py +++ b/jperm/views.py @@ -2,7 +2,7 @@ from django.shortcuts import render_to_response from django.http import HttpResponseRedirect -from juser.models import User +from juser.models import User, UserGroup from jasset.models import Asset from jperm.models import Perm from django.core.paginator import Paginator, EmptyPage, InvalidPage @@ -11,7 +11,9 @@ from django.core.paginator import Paginator, EmptyPage, InvalidPage def perm_host(request): header_title, path1, path2 = u'主机授权 | Perm Host Detail.', u'jperm', u'perm_host' users = contact_list = User.objects.all().order_by('id') + groups = contact_list2 = UserGroup.objects.all().order_by('id') p = paginator = Paginator(contact_list, 10) + p2 = paginator2 = Paginator(contact_list2, 10) try: page = int(request.GET.get('page', '1')) except ValueError: @@ -19,9 +21,11 @@ def perm_host(request): try: contacts = paginator.page(page) + contacts2 = paginator2.page(page) except (EmptyPage, InvalidPage): contacts = paginator.page(paginator.num_pages) - return render_to_response('jperm/perm_host.html', locals(),) + contacts2 = paginator2.page(paginator2.num_pages) + return render_to_response('jperm/perm_host.html', locals()) def perm_add(request): diff --git a/templates/jperm/perm_host.html b/templates/jperm/perm_host.html index ac753eaee..7e10c65c6 100644 --- a/templates/jperm/perm_host.html +++ b/templates/jperm/perm_host.html @@ -29,11 +29,7 @@
-
- 添加 -
-
+ + + + + + + + + + {% for group in contacts2.object_list %} + + + + + + {% endfor %} + +
组名备注操作
{{ group.name }} {{ group.comment }} + 详情 + 编辑 +
+
+
+
+ Showing {{ contacts2.start_index }} to {{ contacts2.end_index }} of {{ p2.count }} entries +
+
+
+
+
    + {% if contacts2.has_previous %} + + {% else %} + + {% endif %} + {% for page in p2.page_range %} + {% ifequal offset1 page %} +
  • {{ page2 }}
  • + {% else %} +
  • {{ page2 }}
  • + {% endifequal %} + {% endfor %} + {% if contacts2.has_next %} + + {% else %} + + {% endif %} +
+
+
+