Browse Source

修改属组授权

pull/6/head
guanghongwei 10 years ago
parent
commit
3903eedc1a
  1. 8
      jperm/views.py
  2. 63
      templates/jperm/perm_host.html

8
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):

63
templates/jperm/perm_host.html

@ -29,11 +29,7 @@
</div>
<div class="ibox-content">
<div class="">
<a target="_blank" href="/jperm/perm_edit/" class="btn btn-sm btn-primary "> 娣诲姞 </a>
</div>
<div class="panel blank-panel">
<div class="panel-heading">
<div class="panel-options">
<ul class="nav nav-tabs">
@ -113,6 +109,65 @@
</div>
<div id="tab-2" class="tab-pane">
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th class="text-center">缁勫悕</th>
<th class="text-center">澶囨敞</th>
<th class="text-center">鎿嶄綔</th>
</tr>
</thead>
<tbody>
{% for group in contacts2.object_list %}
<tr class="gradeX">
<td class="text-center"> {{ group.name }} </td>
<td class="text-center"> {{ group.comment }} </td>
<td class="text-center">
<a href="../perm_detail/?id={{ user.id }}" class="iframe btn btn-xs btn-primary">璇︽儏</a>
<a href="../perm_edit/?id={{ user.id }}" class="btn btn-xs btn-info">缂栬緫</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<div class="col-sm-6">
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
Showing {{ contacts2.start_index }} to {{ contacts2.end_index }} of {{ p2.count }} entries
</div>
</div>
<div class="col-sm-6">
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
<ul class="pagination" style="margin-top: 0; float: right">
{% if contacts2.has_previous %}
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
<a href="?page={{ contacts2.previous_page_number }}">Previous</a>
</li>
{% else %}
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
<a href="#">Previous</a>
</li>
{% endif %}
{% for page in p2.page_range %}
{% ifequal offset1 page %}
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page2 }}" title="绗瑊{ page2 }}椤">{{ page2 }}</a></li>
{% else %}
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page2 }}" title="绗瑊{ page2 }}椤">{{ page2 }}</a></li>
{% endifequal %}
{% endfor %}
{% if contacts2.has_next %}
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
<a href="?page={{ contacts2.next_page_number }}">Next</a>
</li>
{% else %}
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
<a href="#">Next</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
</div>
</div>

Loading鈥
Cancel
Save