# HG changeset patch # User Amit Sethi # Date 1290023454 -19800 # Node ID 4cff1f43e4e1b7eb8b924fddef4a316ecdc3f161 # Parent 29ecd3dd65655f8519595ba68e3ed72d10889ae8 Changes to make it possible for someone to view daily dumps. diff -r 29ecd3dd6565 -r 4cff1f43e4e1 project/scipycon/user/views.py --- a/project/scipycon/user/views.py Wed Nov 17 23:25:09 2010 +0530 +++ b/project/scipycon/user/views.py Thu Nov 18 01:20:54 2010 +0530 @@ -29,6 +29,8 @@ 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 @@ 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 -r 29ecd3dd6565 -r 4cff1f43e4e1 project/templates/user/dump.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project/templates/user/dump.html Thu Nov 18 01:20:54 2010 +0530 @@ -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 -r 29ecd3dd6565 -r 4cff1f43e4e1 project/urls.py --- a/project/urls.py Wed Nov 17 23:25:09 2010 +0530 +++ b/project/urls.py Thu Nov 18 01:20:54 2010 +0530 @@ -9,8 +9,8 @@ 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 @@ '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',