This commit is contained in:
Arne Schauf 2013-09-28 23:03:34 +02:00
parent eb8f548f95
commit 202de726c1
2 changed files with 12 additions and 2 deletions

View File

@ -5,6 +5,7 @@ from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.utils.decorators import method_decorator
from django.core.urlresolvers import reverse
@ -44,8 +45,7 @@ class OverviewView(CreateView):
self.object = form.save(commit=False)
self.object.created_by = self.request.user
self.object.save()
#FIXME: add messages to base.html
#messages.add_message(self.request, messages.SUCCESS, 'Host added.'))
messages.add_message(self.request, messages.SUCCESS, 'Host added.')
return HttpResponseRedirect(self.get_success_url())
def get_context_data(self, *args, **kwargs):

View File

@ -50,6 +50,16 @@
</div>
<div class="container content">
<div id="message_box">
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }}">
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{ message }}
</div>
{% endfor %}
{% endif %}
</div>
{% block content %}
<h1>Heyho!</h1>
<p>Welcome to the base template. Extend this template in all other