From 7612856b726c489598e8e54d22d3af687567778f Mon Sep 17 00:00:00 2001 From: Kenneth Love Date: Fri, 20 Jan 2012 16:55:20 -0800 Subject: [PATCH] better appearance for the form and a sidebar with mandrill status. --- djrill/templates/djrill/senders_list.html | 33 ++++++++++++++++------- djrill/views.py | 25 +++++++---------- settings/base.py | 2 +- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/djrill/templates/djrill/senders_list.html b/djrill/templates/djrill/senders_list.html index 81771e0..653a6e7 100644 --- a/djrill/templates/djrill/senders_list.html +++ b/djrill/templates/djrill/senders_list.html @@ -53,18 +53,31 @@ {% endif %} {% endblock %} -

Add a new sender

-
- {{ form.as_p }} - {% csrf_token %} - -
+
+ {% block search %} +
+
+ + + {% csrf_token %} + +
+
+ {% endblock %} -
- {% block search %}{% endblock %} - {% block date_hierarchy %}{% endblock %} + {% block date_hierarchy %}{% endblock %} - {% block filters %}{% endblock %} + {% block filters %} +
+

Tools & Info

+

Status

+ {% if status %} +

Mandrill is UP

+ {% else %} +

Mandrill is DOWN

+ {% endif %} +
+ {% endblock %} {% block result_list %} {% if objects %} diff --git a/djrill/views.py b/djrill/views.py index 28bad62..41fddb5 100644 --- a/djrill/views.py +++ b/djrill/views.py @@ -75,27 +75,20 @@ class DjrillSendersListView(DjrillAdminMedia, DjrillApiMixin, def get(self, request): form = CreateSenderForm() objects = self.get_json_objects() + + status = False + req = requests.post("%s/%s" % (self.api_url, "users/ping.json"), + data={"key": self.api_key}) + if req.status_code == 200: + status = True + return self.render_to_response({ "objects": json.loads(objects), "media": self.media, - "form": form + "form": form, + "status": status }) - def post(self, request): - form = CreateSenderForm(request.POST or None) - - if form.is_valid(): - return HttpResponseRedirect(reverse("admin:djrill_senders")) - - objects = self.get_json_objects() - return self.render_to_response({ - "objects": json.loads(objects), - "media": self.media, - "form": form - }) - - - class DjrillSenderView(DjrillApiMixin, View): api_action = None diff --git a/settings/base.py b/settings/base.py index c79b5b7..56782bc 100644 --- a/settings/base.py +++ b/settings/base.py @@ -22,7 +22,7 @@ DATABASES = { #MANDRILL MANDRILL_API_KEY = None -MANDRILL_API_URL = "http://mandrillapp.com/api/1.0/" +MANDRILL_API_URL = "http://mandrillapp.com/api/1.0" # Local time zone for this installation. Choices can be found here: