aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeitian LI <liweitianux@gmail.com>2014-04-27 17:38:05 +0800
committerWeitian LI <liweitianux@gmail.com>2014-04-27 17:38:05 +0800
commitb784a30dd8c92f8e7f49a15e564c8ff422e85f94 (patch)
tree009e8f14d0066a282874748535afd222a60d682d
parentd666b7654b29645d70f85012d3008928b38a4031 (diff)
downloaddjango-skaschool-b784a30dd8c92f8e7f49a15e564c8ff422e85f94.tar.bz2
* updated 'list_approved.html' and related 'ListApprovedView'
* small update to 'profile.html'
-rw-r--r--account/templates/account/list_approved.html20
-rw-r--r--account/templates/account/profile.html6
-rw-r--r--account/views.py4
3 files changed, 19 insertions, 11 deletions
diff --git a/account/templates/account/list_approved.html b/account/templates/account/list_approved.html
index bf6bf2f..6295765 100644
--- a/account/templates/account/list_approved.html
+++ b/account/templates/account/list_approved.html
@@ -14,24 +14,30 @@
<div class="container">
<h2>审定名单</h2>
<br>
+ {# alert if the user not approved #}
+ {% if profile.is_approved == 'N' %}
+ <div class="alert alert-warning">
+ 很抱歉,您未能被批准参加本次SKA暑期学校,感谢您的关注和参与。
+ </div>
+ {% endif %}
{% if object_list %}
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th class="col-md-1 list-number">序号</th>
<th class="col-md-2 list-name">姓名</th>
- <th class="col-md-2 list-identify">身份</th>
- <th class="col-md-7 list-institute">单位</th>
+ <th class="col-md-3 list-identify">身份</th>
+ <th class="col-md-6 list-institute">单位</th>
</tr>
</thead>
<tbody>
{# mark out current user if approved #}
- {% for profile in object_list %}
- <tr{% if profile.user == user %} class="success"{% endif %}>
+ {% for approved_profile in object_list %}
+ <tr{% if approved_profile.user == user %} class="success"{% endif %}>
<td>{{ forloop.counter }}</td>
- <td>{{ profile.realname }}</td>
- <td>{% trans profile.get_identify_value %}</td>
- <td>{{ profile.institute }}</td>
+ <td>{{ approved_profile.realname }}</td>
+ <td>{% trans approved_profile.get_identify_value %}</td>
+ <td>{{ approved_profile.institute }}</td>
</tr>
{% endfor %}
</tbody>
diff --git a/account/templates/account/profile.html b/account/templates/account/profile.html
index aa99650..f36c114 100644
--- a/account/templates/account/profile.html
+++ b/account/templates/account/profile.html
@@ -45,7 +45,7 @@
{% elif profile.gender == 'F' %}
{% elif profile.gender == 'X' %}
- <span class="glyphicon glyphicon-ban-circle"></span>
+ <span class="glyphicon glyphicon-ban-circle"></span>保密
{% else %}
<span class="glyphicon glyphicon-warning-sign"></span> <span class="label label-danger">系统错误</span>
{% endif %}
@@ -106,18 +106,18 @@
</td>
</tr>
{# user uploaded files #}
+ {% if userfiles %}
<tr>
<th class="attachments">附件</th>
<td class="attachments-data">
- {% if userfiles %}
<ul>
{% for attachment in userfiles %}
<li><a href="{{ attachment.file.url }}">{{ attachment.title }}</a></li>
{% endfor %}
</ul>
- {% endif %}
</td>
</tr>
+ {% endif %}
</table>
<br>
diff --git a/account/views.py b/account/views.py
index faf0a43..d998c6e 100644
--- a/account/views.py
+++ b/account/views.py
@@ -130,11 +130,13 @@ class ListApprovedView(ListView):
def get_context_data(self, **kwargs):
"""
- add 'user' context
+ add 'user' and 'profile' context
"""
context = super(ListApprovedView, self).get_context_data(**kwargs)
user = self.request.user
+ profile = user.userprofile_set.get(user=user)
context['user'] = user
+ context['profile'] = profile
return context