{% extends "admin/base_site.html" %}
{% load i18n admin_static %}
{% load url from future %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}

{% block bodyclass %}change-form{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url "admin:index" %}">{% trans "Home" %}</a>
&rsaquo; <a href="{% url "rq_stats" %}">{% trans "RQ Status" %}</a>
&rsaquo; <a href="{% url "rq_queue" queue.name %}">{{ queue.name }}</a>
&rsaquo; {{ job.id }}
</div>
{% endblock %}

{% block content %}
	<div id="content-main">
		<div class="module">
			<dl>
				<dt>{% trans "Job ID" %}</dt>
				<dd>{{ job.id }}</dd>

				<dt>{% trans "Description" %}</dt>
				<dd>{{ job.description }}</dd>

				<dt>{% trans "Queue" %}</dt>
				<dd>{{ job.origin }}</dd>

				<dt>{% trans "Date created" %}</dt>
				<dd>{{ job.created_at }} ({% blocktrans with job.created_at|timesince as ago %}{{ ago }} ago{% endblocktrans %})</dd>

				<dt>{% trans "Date enqueued" %}</dt>
				<dd>{{ job.enqueued_at }} ({% blocktrans with job.enqueued_at|timesince as ago %}{{ ago }} ago{% endblocktrans %})</dd>

				<dt>{% trans "Date ended" %}</dt>
				<dd>{{ job.ended_at }}{% if job.ended_at %} ({% blocktrans with job.ended_at|timesince as ago %}{{ ago }} ago{% endblocktrans %}){% endif %}</dd>

				<dt>{% trans "Result" %}</dt>
				<dd>{{ job.result }}</dd>

				<dt>{% trans "Redis key" %}</dt>
				<dd>{{ job.key }}</dd>

				{% if job.exc_info %}
					<dt>{% trans "Exception" %}</dt>
					<dd><pre><code>{{ job.exc_info }}</code></pre></dd>
				{% endif %}
			</dl>
		</div>
		<form method="post" action="{% url "rq_job" job.id %}">
			{% csrf_token %}
			<div class="submit-row">
				{% if job.is_failed %}
					<input type="submit" name="requeue" value="{% trans "Requeue" %}">
				{% endif %}
				<input type="submit" name="cancel" value="{% trans "Cancel" %}">
			</div>
		</form>
	</div>
{% endblock %}
