diff options
author | Amit Sethi | 2010-11-18 01:20:54 +0530 |
---|---|---|
committer | Amit Sethi | 2010-11-18 01:20:54 +0530 |
commit | 6fd8bc041f4e6a0fcd2b2107b25abe33b4d52b79 (patch) | |
tree | 0b1d7d5872c91d5cbee78873b8a7470766766f9b | |
parent | c0e53373844dd79338efa358868af43658d4a8d4 (diff) | |
download | scipycon-6fd8bc041f4e6a0fcd2b2107b25abe33b4d52b79.tar.gz scipycon-6fd8bc041f4e6a0fcd2b2107b25abe33b4d52b79.tar.bz2 scipycon-6fd8bc041f4e6a0fcd2b2107b25abe33b4d52b79.zip |
Changes to make it possible for someone to view daily dumps.
-rw-r--r-- | project/scipycon/user/views.py | 39 | ||||
-rw-r--r-- | project/templates/user/dump.html | 126 | ||||
-rw-r--r-- | project/urls.py | 8 |
3 files changed, 170 insertions, 3 deletions
diff --git a/project/scipycon/user/views.py b/project/scipycon/user/views.py index 92af31b..5f3b1be 100644 --- a/project/scipycon/user/views.py +++ b/project/scipycon/user/views.py @@ -29,6 +29,8 @@ from project.scipycon.user.utils import handle_uploaded_photo from project.scipycon.user.utils import scipycon_createuser from project.scipycon.utils import set_message_cookie +#User_dump Http404 Error +from django.http import Http404 @login_required def account(request, scope, template_name="user/account.html"): @@ -277,3 +279,40 @@ def get_usernames(request, scope): json_response = {'results': results} return HttpResponse(json.dumps(json_response)) + + +@login_required +def get_user_dump(request, scope,template_name='user/dump.html'): + """ Gets a general dump of user related info + """ + print request.user.is_staff + if request.user.is_staff: + qs=Registration.objects.all() + rows=[] + for obj in qs: + row = {} + row['first_name'] = obj.registrant.first_name + row['last_name'] = obj.registrant.last_name + try: + accomodation_require = Accommodation.objects.filter(user__username=obj.registrant.username)[0] + row['sex'] = accomodation_require.sex + except: + row['sex'] = 'Acco. Unspecified' + row['city'] = obj.city + row['organization'] = obj.organisation + row['occupation'] = obj.occupation + row['conference'] = obj.conference + row['sprint'] = obj.sprint + row['tutorial'] = obj.tutorial + try: + wifi_require = Wifi.objects.filter(user__username=obj.registrant.username)[0] + row['wifi'] = wifi_require.wifi + except: + row['wifi']='Wifi Unspecified' + rows.append(row) + return render_to_response(template_name, RequestContext(request, { + 'rows': rows})) + + + else: + raise Http404 diff --git a/project/templates/user/dump.html b/project/templates/user/dump.html new file mode 100644 index 0000000..6caa25d --- /dev/null +++ b/project/templates/user/dump.html @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+lang="en" xml:lang="en">
+<head>
+<title>Dump</title>
+<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
+<meta name="generator" content="Org-mode"/>
+<meta name="generated" content="2010-11-12 18:35:22 IST"/>
+<meta name="author" content="amit"/>
+<meta name="description" content=""/>
+<meta name="keywords" content=""/>
+<style type="text/css">
+ <!--/*--><![CDATA[/*><!--*/
+ html { font-family: Times, serif; font-size: 12pt; }
+ .title { text-align: center; }
+ .todo { color: red; }
+ .done { color: green; }
+ .tag { background-color: #add8e6; font-weight:normal }
+ .target { }
+ .timestamp { color: #bebebe; }
+ .timestamp-kwd { color: #5f9ea0; }
+ p.verse { margin-left: 3% }
+ pre {
+ border: 1pt solid #AEBDCC;
+ background-color: #F3F5F7;
+ padding: 5pt;
+ font-family: courier, monospace;
+ font-size: 90%;
+ overflow:auto;
+ }
+ table { border-collapse: collapse; }
+ td, th { vertical-align: top; }
+ dt { font-weight: bold; }
+ div.figure { padding: 0.5em; }
+ div.figure p { text-align: center; }
+ textarea { overflow-x: auto; }
+ .linenr { font-size:smaller }
+ .code-highlighted {background-color:#ffff00;}
+ .org-info-js_info-navigation { border-style:none; }
+ #org-info-js_console-label { font-size:10px; font-weight:bold;
+ white-space:nowrap; }
+ .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
+ font-weight:bold; }
+ /*]]>*/-->
+</style>
+<script type="text/javascript">
+<!--/*--><![CDATA[/*><!--*/
+ function CodeHighlightOn(elem, id)
+ {
+ var target = document.getElementById(id);
+ if(null != target) {
+ elem.cacheClassElem = elem.className;
+ elem.cacheClassTarget = target.className;
+ target.className = "code-highlighted";
+ elem.className = "code-highlighted";
+ }
+ }
+ function CodeHighlightOff(elem, id)
+ {
+ var target = document.getElementById(id);
+ if(elem.cacheClassElem)
+ elem.className = elem.cacheClassElem;
+ if(elem.cacheClassTarget)
+ target.className = elem.cacheClassTarget;
+ }
+/*]]>*///-->
+</script>
+</head>
+<body>
+<div id="content">
+
+<h1 class="title">Dump</h1>
+
+
+<div id="table-of-contents">
+<h2>Table of Contents</h2>
+<div id="text-table-of-contents">
+<ul>
+<li><a href="#sec-1">1 Scipy Dump </a></li>
+</ul>
+</div>
+</div>
+
+<div id="outline-container-1" class="outline-2">
+<h2 id="sec-1"><span class="section-number-2">1</span> Scipy Dump 12 Nov 6:34 </h2>
+<div class="outline-text-2" id="text-1">
+
+
+<ul>
+<li>
+Gender - '–' in case not specified
+</li>
+<li>
+C - Conference
+</li>
+<li>
+S - Sprints
+</li>
+<li>
+T - Tutorial
+</li>
+<li>
+L - Bring a Laptop
+
+<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
+<caption></caption>
+<colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="right" /><col align="right" /><col align="right" /><col align="right" />
+</colgroup>
+<tbody>
+<tr><td>first name</sub></td><td>last name</sub></td><td>Gender</td><td>City</td><td>Organization</td><td>Occupation</td><td>C</td><td>S</td><td>T</td><td>L</td></tr>
+
+{% for row in rows %}
+<tr><td>{{ row.first_name }}</td><td>{{ row.last_name }}</td><td>{{ row.sex }}</td><td>{{ row.city }}</td><td>{{ row.organization }}</td><td>{{ row.occupation }}</td><td>{{ row.conference }}</td><td>{{ row.sprint }}</td><td>{{ row.tutorial }}</td><td>{{ row.wifi }}</td></tr>
+
+{% endfor %}
+</table>
+
+</li>
+</ul>
+</div>
+</div>
+</div>
+</body>
+</html>
diff --git a/project/urls.py b/project/urls.py index 1a7c33d..90e6c87 100644 --- a/project/urls.py +++ b/project/urls.py @@ -9,8 +9,8 @@ from django.views.generic.simple import redirect_to admin.autodiscover() -PROGRAM_PATTERN_CORE = r'scipyin' -EVENT_PATTERN_CORE =r'2010' +PROGRAM_PATTERN_CORE = r'[a-z](?:[0-9a-z]|_[0-9a-z])*' +EVENT_PATTERN_CORE =r'(?:[0-9a-z]|_[0-9a-z])*' SCOPE_ARG_PATTERN = r'(?P<scope>%s/%s)' % ( PROGRAM_PATTERN_CORE, EVENT_PATTERN_CORE) @@ -71,7 +71,9 @@ urlpatterns += patterns('project.scipycon.user.views', 'edit_profile', name='scipycon_edit_profile'), url(r'^%s/get-usernames/$' % (SCOPE_ARG_PATTERN), 'get_usernames', name='scipycon_get_usernames'), - ) + url(r'^%s/get-user-dump/$' % (SCOPE_ARG_PATTERN), + 'get_user_dump', name='scipycon_get_usernames')) + # Proceedings urlpatterns += patterns('project.scipycon.proceedings.views', |