mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
status template
This commit is contained in:
@@ -2,5 +2,6 @@ from django.contrib import admin
|
|||||||
|
|
||||||
from djrill.views import DjrillIndexView, DjrillSendersListView
|
from djrill.views import DjrillIndexView, DjrillSendersListView
|
||||||
|
|
||||||
admin.site.register_view("djrill/senders/", DjrillSendersListView.as_view())
|
admin.site.register_view("djrill/senders/", DjrillSendersListView.as_view(),
|
||||||
admin.site.register_view("djrill/", DjrillIndexView.as_view(), "Djrill")
|
"senders")
|
||||||
|
admin.site.register_view("djrill/status/", DjrillIndexView.as_view(), "status")
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<caption>Djrill</caption>
|
<caption>Djrill</caption>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for path, name in custom_list %}
|
{% for path, name in custom_list %}
|
||||||
<tr><td><a href="{{ path }}">{{ name }}</a></td></tr>
|
<tr><td><a href="{{ path }}">{{ name|capfirst }}</a></td></tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
66
djrill/templates/djrill/status.html
Normal file
66
djrill/templates/djrill/status.html
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
{% extends "admin/base_site.html" %}
|
||||||
|
{% load adminmedia admin_list i18n %}
|
||||||
|
{% load url from future %}
|
||||||
|
{% block extrastyle %}
|
||||||
|
{{ block.super }}
|
||||||
|
<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/changelists.css" />
|
||||||
|
{{ media.css }}
|
||||||
|
{% if not actions_on_top and not actions_on_bottom %}
|
||||||
|
<style>
|
||||||
|
#changelist table thead th:first-child {width: inherit}
|
||||||
|
</style>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block extrahead %}
|
||||||
|
{{ block.super }}
|
||||||
|
{{ media.js }}
|
||||||
|
{% if action_form %}{% if actions_on_top or actions_on_bottom %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function($) {
|
||||||
|
$(document).ready(function($) {
|
||||||
|
$("tr input.action-select").actions();
|
||||||
|
});
|
||||||
|
})(django.jQuery);
|
||||||
|
</script>
|
||||||
|
{% endif %}{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block bodyclass %}change-list{% endblock %}
|
||||||
|
|
||||||
|
{% if not is_popup %}
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
<div class="breadcrumbs">
|
||||||
|
<a href="../../">
|
||||||
|
{% trans "Home" %}
|
||||||
|
</a>
|
||||||
|
›
|
||||||
|
<a href="../">
|
||||||
|
Djrill
|
||||||
|
</a>
|
||||||
|
›
|
||||||
|
Status
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% block coltype %}flex{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div id="content-main">
|
||||||
|
{% block object-tools %}
|
||||||
|
{% endblock %}
|
||||||
|
<div>
|
||||||
|
{% block search %}{% endblock %}
|
||||||
|
{% block date_hierarchy %}{% endblock %}
|
||||||
|
|
||||||
|
{% block filters %}{% endblock %}
|
||||||
|
{% block pagination %}{% endblock %}
|
||||||
|
<dl>
|
||||||
|
{% for term, value in status.items %}
|
||||||
|
<dt>{{ term|capfirst }}</dt>
|
||||||
|
<dd>{{ value }}</dd>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.utils import simplejson as json
|
from django.utils import simplejson as json
|
||||||
from django.views.generic import View, TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import requests
|
import requests
|
||||||
@@ -41,14 +40,15 @@ class DjrillApiJsonObjectsMixin(object):
|
|||||||
raise Exception("OH GOD, NO!")
|
raise Exception("OH GOD, NO!")
|
||||||
|
|
||||||
|
|
||||||
class DjrillIndexView(DjrillApiMixin, View):
|
class DjrillIndexView(DjrillApiMixin, TemplateView):
|
||||||
|
template_name = "djrill/status.html"
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
|
||||||
payload = json.dumps({"key": self.api_key})
|
payload = json.dumps({"key": self.api_key})
|
||||||
r = requests.post("%s/users/info.json" % self.api_url, data=payload)
|
req = requests.post("%s/users/info.json" % self.api_url, data=payload)
|
||||||
|
|
||||||
return HttpResponse(r.content)
|
return self.render_to_response({"status": json.loads(req.content)})
|
||||||
|
|
||||||
|
|
||||||
class DjrillSendersListView(DjrillApiMixin, DjrillApiJsonObjectsMixin,
|
class DjrillSendersListView(DjrillApiMixin, DjrillApiJsonObjectsMixin,
|
||||||
|
|||||||
Reference in New Issue
Block a user