Permalink
Browse files

Flash messages work! Also display a success message upon profile save…

…. FCP3 task complete.
  • Loading branch information...
1 parent 265bafe commit bd0597d4caf87c94c3b6a4e557b7666b831e9e4a @nolanlum committed Dec 6, 2011
Showing with 42 additions and 1 deletion.
  1. +32 −1 portal/static/styles.css
  2. +3 −0 portal/views.py
  3. +7 −0 web_template/base.html
View
@@ -19,6 +19,37 @@ body {
width: 100%;
}
+#messages {
+ position: absolute;
+ top: 20px;
+ z-index: 1;
+
+ margin-left: -250px;
+ left: 50%;
+ width: 500px;
+
+ text-align: center;
+}
+#messages > div {
+ width: 100%;
+}
+
+#messages > div > div {
+ padding: 3px;
+ margin: 6px auto;
+
+ display: inline-block;
+
+ font-weight: bold;
+
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.msg-success { color: #2e3436; background-color: #8ae234; border: #73d216 3px solid; }
+.msg-warning { color: #2e3436; background-color: #fce94f; border: #edd400 3px solid; }
+.msg-error { color: #eeeeec; background-color: #ef2929; border: #cc0000 3px solid; }
+
#sidebar {
position: absolute;
top: 0;
@@ -29,7 +60,7 @@ body {
-moz-border-radius: 3px;
border-radius: 3px;
- background-color: #ffdb70;
+ background-color: #fce94f;
}
.centerbox {
View
@@ -25,6 +25,7 @@
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404, Http404
+from django.contrib import messages
from fBSD_Portal.portal.models import CommPortalProfile
from social_auth.models import UserSocialAuth
@@ -98,6 +99,8 @@ def user(request, id):
for x in PROFILE_FIELDS:
setattr(prof, x[1], "" if request.POST[x[1]] == "None entered." else request.POST[x[1]] )
prof.save()
+
+ messages.success(request, "Your profile information has been saved!")
# Fill stuff with stuff.
for x in d['user_fields']:
View
@@ -10,6 +10,13 @@
{% block head %}{% endblock %}
</head>
<body>
+{% if messages %}
+ <div id="messages">
+ {% for message in messages %}
+ <div><div{% if message.tags %} class="msg-{{ message.tags }}"{% endif %}>{{ message }}</div></div>
+ {% endfor %}
+ </div>
+{% endif %}
<div id="sidebar">
{% block sidebar %}{% endblock %}
</div>

0 comments on commit bd0597d

Please sign in to comment.