Merge branch 'master' of github.com:brack3t/Djrill into feature/backend

This commit is contained in:
Chris Jones
2012-01-20 16:59:36 -08:00
3 changed files with 33 additions and 27 deletions

View File

@@ -53,18 +53,31 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
<p>Add a new sender</p> <div class="module filtered" id="changelist">
<form action="{% url "admin:djrill_add_sender" %}" method="POST"> {% block search %}
{{ form.as_p }} <div id="toolbar">
{% csrf_token %} <form action="{% url "admin:djrill_add_sender" %}" method="POST">
<input type="submit" value="Submit"> <label for="id_email" class="addlink">Add a new sender</label>
</form> <input type="email" placeholder="E-mail address" name="email" id="id_email">
{% csrf_token %}
<input type="submit" value="Submit">
</form>
</div>
{% endblock %}
<div class="module" id="changelist"> {% block date_hierarchy %}{% endblock %}
{% block search %}{% endblock %}
{% block date_hierarchy %}{% endblock %}
{% block filters %}{% endblock %} {% block filters %}
<div id="changelist-filter">
<h2>Tools &amp; Info</h2>
<h3>Status</h3>
{% if status %}
<p>Mandrill is <strong>UP</strong></p>
{% else %}
<p>Mandrill is <strong>DOWN</strong></p>
{% endif %}
</div>
{% endblock %}
{% block result_list %} {% block result_list %}
{% if objects %} {% if objects %}

View File

@@ -75,27 +75,20 @@ class DjrillSendersListView(DjrillAdminMedia, DjrillApiMixin,
def get(self, request): def get(self, request):
form = CreateSenderForm() form = CreateSenderForm()
objects = self.get_json_objects() 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({ return self.render_to_response({
"objects": json.loads(objects), "objects": json.loads(objects),
"media": self.media, "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): class DjrillSenderView(DjrillApiMixin, View):
api_action = None api_action = None

View File

@@ -22,7 +22,7 @@ DATABASES = {
#MANDRILL #MANDRILL
MANDRILL_API_KEY = None MANDRILL_API_KEY = None
MANDRILL_API_URL = "http://mandrillapp.com/api/1.0/" MANDRILL_API_URL = "http://mandrillapp.com/api/1.0"
#EMAIL BACKEND #EMAIL BACKEND
EMAIL_BACKEND = "djrill.mail.backends.djrill.DjrillBackend" EMAIL_BACKEND = "djrill.mail.backends.djrill.DjrillBackend"