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 %} +
+
+
+