From 6fd8bc041f4e6a0fcd2b2107b25abe33b4d52b79 Mon Sep 17 00:00:00 2001 From: Amit Sethi Date: Thu, 18 Nov 2010 01:20:54 +0530 Subject: Changes to make it possible for someone to view daily dumps. --- project/scipycon/user/views.py | 39 ++++++++++++ project/templates/user/dump.html | 126 +++++++++++++++++++++++++++++++++++++++ project/urls.py | 8 ++- 3 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 project/templates/user/dump.html 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 @@ + + + + +Dump + + + + + + + + + + +
+ +

Dump

+ + +
+

Table of Contents

+ +
+ +
+

1 Scipy Dump 12 Nov 6:34

+
+ + +
    +
  • +Gender - '–' in case not specified +
  • +
  • +C - Conference +
  • +
  • +S - Sprints +
  • +
  • +T - Tutorial +
  • +
  • +L - Bring a Laptop + + + ++ + + + +{% for row in rows %} + + +{% endfor %} +
    first namelast nameGenderCityOrganizationOccupationCSTL
    {{ row.first_name }}{{ row.last_name }}{{ row.sex }}{{ row.city }}{{ row.organization }}{{ row.occupation }}{{ row.conference }}{{ row.sprint }}{{ row.tutorial }}{{ row.wifi }}
    + +
  • +
+
+
+
+ + 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%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', -- cgit