Added basic interface to add to the blacklist from inside auth

This commit is contained in:
2011-11-27 22:26:20 +00:00
parent 7b34027b54
commit 362c4c31cd
5 changed files with 140 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
{% extends "base.html" %}
{% block title %}Add Blacklist Entry{% endblock %}
{% block content %}
<h1>Add Blacklist Entry</h1>
<form action="{% url hr-blacklist-add %}" method="post">
<table>
{{ form.as_table }}
</table>
{% csrf_token %}
<input type="submit" value="Blacklist" />
</form>
{% endblock %}

View File

@@ -0,0 +1,43 @@
{% extends "base.html" %}
{% load naturaltimediff %}
{% block title %}Blacklist{% endblock %}
{% block content %}
<h1>Blacklist</h1>
{% if object_list %}
<form method="get" action="{% url hr-blacklist-list %}">
<label for="query">Search:</label>
<input type="text" name="q" id="query" value="{% if query %}{{ query }}{% endif %}"/>
</form>
<table>
<thead>
<th>ID</th><th>Type</th><th>Value</th><th>Level</th><th>Reason</th><th>Expiry</th>
</thead>
<tbody>
{% for obj in object_list %}
<tr><td>{{ obj.id }}</td><td>{{ obj.get_type_display }}</td><td>{{ obj.value }}</td><td>{{ obj.get_level_display }}</td><td>{{ obj.reason }}</td><td>{{ obj.expiry_date }}</td></tr>
{% endfor %}
</tbody>
</table>
{% if is_paginated %}
<div class="pagination">
<ul>
<li class="prev{% if not page_obj.has_previous %} disabled{% endif %}"><a href="{% if page_obj.has_previous %}?page={{ page_obj.previous_page_number }}{% endif %}">Previous</a></li>
{% for i in paginator.page_range %}
<li{% if i == page.number %} class="active"{% endif %}><a href="?page={{ i }}">{{ i }}</a></li>
{% endfor %}
<li class="next{% if not page_obj.has_next %} disabled{% endif %}"><a href="{% if page_obj.has_next %}?page={{page_obj.next_page_number }}{% endif %}">Next</a>
</ul>
</div>
{% endif %}
{% else %}
<p>No blacklist entries {% if query %}containing "{{ query }}" {% endif %}were found.</p>
{% endif %}
{% if perms.hr.add_blacklist %}
<p><a href="{% url hr-blacklist-add %}">Add a blacklist entry</a></p>
{% endif %}
{% endblock %}

View File

@@ -24,4 +24,13 @@
</p>
{% endif %}
{% if perms.add_blacklist %}
<h3>Blacklist Management</h3>
<p>
<ul>
<li><a href="{% url hr-blacklist-list %}">View/Search Blacklist</a></li>
<li><a href="{% url hr-blacklist-add %}">Add Blacklist Entry</a></li>
</p>
{% endif %}
{% endblock %}