mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-15 07:12:16 +00:00
Standardised the URLs and enabled search function on applications
This commit is contained in:
22
hr/urls.py
22
hr/urls.py
@@ -4,17 +4,17 @@ from hr import views
|
|||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
('^$', views.index),
|
('^$', views.index),
|
||||||
(r'^recommendations/$', views.view_recommendations),
|
(r'^recommendation/$', views.view_recommendations),
|
||||||
(r'^recommendations/(?P<recommendationid>.*)/$', views.view_recommendation),
|
(r'^recommendation/(?P<recommendationid>.*)/$', views.view_recommendation),
|
||||||
(r'^applications/$', views.view_applications),
|
(r'^application/$', views.view_applications),
|
||||||
(r'^applications/(?P<applicationid>\d+)/$', views.view_application),
|
(r'^application/(?P<applicationid>\d+)/$', views.view_application),
|
||||||
(r'^applications/(?P<applicationid>\d+)/update/(?P<status>\d+)/$', views.update_application),
|
(r'^application/(?P<applicationid>\d+)/update/(?P<status>\d+)/$', views.update_application),
|
||||||
(r'^applications/(?P<applicationid>\d+)/note/$', views.add_note),
|
(r'^application/(?P<applicationid>\d+)/note/$', views.add_note),
|
||||||
(r'^applications/(?P<applicationid>\d+)/reject/$', views.reject_application),
|
(r'^application/(?P<applicationid>\d+)/reject/$', views.reject_application),
|
||||||
(r'^applications/(?P<applicationid>\d+)/accept/$', views.accept_application),
|
(r'^application/(?P<applicationid>\d+)/accept/$', views.accept_application),
|
||||||
|
|
||||||
(r'^add/application/$', views.add_application),
|
(r'^application/add/$', views.add_application),
|
||||||
(r'^add/recommendation/$', views.add_recommendation),
|
(r'^recommendation/add/$', views.add_recommendation),
|
||||||
|
|
||||||
(r'^admin/applications/$', views.admin_applications),
|
(r'^application/admin$', views.admin_applications),
|
||||||
)
|
)
|
||||||
|
|||||||
14
hr/views.py
14
hr/views.py
@@ -151,8 +151,18 @@ def admin_applications(request):
|
|||||||
if not (request.user.is_staff or Group.objects.get(name=settings.HR_STAFF_GROUP) in request.user.groups.all()):
|
if not (request.user.is_staff or Group.objects.get(name=settings.HR_STAFF_GROUP) in request.user.groups.all()):
|
||||||
return HttpResponseRedirect(reverse('hr.views.index'))
|
return HttpResponseRedirect(reverse('hr.views.index'))
|
||||||
|
|
||||||
view_status = [APPLICATION_STATUS_AWAITINGREVIEW, APPLICATION_STATUS_ACCEPTED, APPLICATION_STATUS_QUERY]
|
if 'q' in request.GET:
|
||||||
apps = Application.objects.filter(status__in=view_status)
|
query = request.GET['q']
|
||||||
|
if 'l' in request.GET:
|
||||||
|
limit = request.get['l']
|
||||||
|
else:
|
||||||
|
limit = 10
|
||||||
|
print query, limit
|
||||||
|
apps = Application.objects.filter(character__name__icontains=query)[:limit]
|
||||||
|
else:
|
||||||
|
view_status = [APPLICATION_STATUS_AWAITINGREVIEW, APPLICATION_STATUS_ACCEPTED, APPLICATION_STATUS_QUERY]
|
||||||
|
apps = Application.objects.filter(status__in=view_status)
|
||||||
|
|
||||||
return render_to_response('hr/applications/admin/view_list.html', locals(), context_instance=RequestContext(request))
|
return render_to_response('hr/applications/admin/view_list.html', locals(), context_instance=RequestContext(request))
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
{% block title %}Applications{% endblock %}
|
{% block title %}Applications{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p>This list shows all current applications open for review.</p>
|
|
||||||
|
<h3>Search All Applications</h3>
|
||||||
|
<form method="GET" action="{% url hr.views.admin_applications %}">
|
||||||
|
<input type="text" name="q" />
|
||||||
|
<input type="submit" value="Search" />
|
||||||
|
</form>
|
||||||
|
|
||||||
{% if apps %}
|
{% if apps %}
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Application ID</th><th>Character</th><th>Corporation</th><th>Application Status</th></tr>
|
<tr><th>Application ID</th><th>Character</th><th>Corporation</th><th>Application Status</th></tr>
|
||||||
@@ -16,7 +22,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>No current open applications</p>
|
<p>No applications found.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user