mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Allow the application list to be ordered
This commit is contained in:
20
hr/views.py
20
hr/views.py
@@ -70,7 +70,7 @@ def index(request):
|
||||
def view_applications(request):
|
||||
""" Shows a list of the user's applications """
|
||||
|
||||
apps = Application.objects.filter(user=request.user)
|
||||
apps = Application.objects.filter(user=request.user).order_by('id')
|
||||
return render_to_response('hr/applications/view_list.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
@login_required
|
||||
@@ -163,19 +163,25 @@ def admin_applications(request):
|
||||
|
||||
# Get the list of viewable applications by the admin
|
||||
corplist = EVEPlayerCharacter.objects.filter(eveaccount__user=request.user).values_list('corporation', flat=True)
|
||||
view_status = [APPLICATION_STATUS_AWAITINGREVIEW, APPLICATION_STATUS_ACCEPTED, APPLICATION_STATUS_QUERY]
|
||||
|
||||
apps = Application.objects.filter(corporation__id__in=list(corplist))
|
||||
|
||||
if 'q' in request.GET:
|
||||
query = request.GET['q']
|
||||
if 'l' in request.GET:
|
||||
limit = request.get['l']
|
||||
else:
|
||||
limit = 10
|
||||
apps = apps.filter(character__name__icontains=query)[:limit]
|
||||
apps = apps.filter(character__name__icontains=query)
|
||||
else:
|
||||
view_status = [APPLICATION_STATUS_AWAITINGREVIEW, APPLICATION_STATUS_ACCEPTED, APPLICATION_STATUS_QUERY]
|
||||
apps = apps.filter(status__in=view_status)
|
||||
|
||||
if 'o' in request.GET:
|
||||
order = request.GET['o']
|
||||
if order in ['id', 'corporation', 'name']:
|
||||
apps = apps.order_by(order)
|
||||
|
||||
if 'l' in request.GET:
|
||||
limit = request.get['l']
|
||||
apps = apps[:limit]
|
||||
|
||||
return render_to_response('hr/applications/admin/view_list.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
@login_required
|
||||
|
||||
@@ -120,6 +120,15 @@ border-bottom: 2px #fff solid;
|
||||
font-size: 12px;
|
||||
font-weight: bold;}
|
||||
|
||||
table th a
|
||||
{color: #fff;
|
||||
}
|
||||
|
||||
table th a:visted
|
||||
{color: #fff;
|
||||
}
|
||||
|
||||
|
||||
.character_info > div { margin-bottom: 2em; }
|
||||
.character_info .character_portrait, .character_info .character_corporation, .character_info .character_alliance { float: right; }
|
||||
.character_info .character_corporation { clear: right; margin-left: 2em; }
|
||||
|
||||
@@ -12,7 +12,10 @@
|
||||
|
||||
{% if apps %}
|
||||
<table>
|
||||
<tr><th>Application ID</th><th>Character</th><th>Corporation</th><th>Application Status</th></tr>
|
||||
<tr><th><a href="{% url hr.views.admin_applications %}?o=id">Application ID</a></th>
|
||||
<th><a href="{% url hr.views.admin_applications %}?o=character">Character</a></th>
|
||||
<th><a href="{% url hr.views.admin_applications %}?o=corporation">Corporation</a></th>
|
||||
<th>Application Status</th></tr>
|
||||
{% for app in apps %}
|
||||
<tr><td><a href="{% url hr.views.view_application app.id %}">{{ app.id }}</a></td>
|
||||
<td>{{ app.character }}</td>
|
||||
|
||||
Reference in New Issue
Block a user