diff options
author | Madhusudan.C.S | 2010-11-02 22:32:38 +0530 |
---|---|---|
committer | Madhusudan.C.S | 2010-11-02 22:32:38 +0530 |
commit | a4b98641550159436c47b039b84788214f89cebf (patch) | |
tree | 2eeea1c4716995447bbfa5724baa4d3d09d63a11 | |
parent | 2f5eb55007dd5dae1c37fa82fa91aa91089c8311 (diff) | |
download | scipycon-a4b98641550159436c47b039b84788214f89cebf.tar.gz scipycon-a4b98641550159436c47b039b84788214f89cebf.tar.bz2 scipycon-a4b98641550159436c47b039b84788214f89cebf.zip |
View to calculate the number of registrants per event.
-rw-r--r-- | project/scipycon/registration/views.py | 65 | ||||
-rw-r--r-- | project/static/css/styles.css | 26 |
2 files changed, 38 insertions, 53 deletions
diff --git a/project/scipycon/registration/views.py b/project/scipycon/registration/views.py index 6dea7e3..04d79a3 100644 --- a/project/scipycon/registration/views.py +++ b/project/scipycon/registration/views.py @@ -256,63 +256,22 @@ def submit_registration(request, scope, @login_required def regstats(request, scope, - template_name='registration/regstats.html'): + template_name='registration/regstats.html'): """View that gives the statistics of registrants. """ - from project.scipycon.registration.forms import RegistrationAdminSelectForm + if not request.user.is_staff: redirect_to = reverse('scipycon_login', kwargs={'scope': scope}) - if request.method == "POST": - form = RegistrationAdminSelectForm(request.POST) - if form.is_valid(): - conference = form.cleaned_data['by_conference'] - tutorial = form.cleaned_data['by_tutorial'] - sprint = form.cleaned_data['by_sprint'] - include = form.cleaned_data['include'] - - q = Registration.objects.all() - q = q.filter(conference=conference) - q = q.filter(tutorial=tutorial) - q = q.filter(sprint=sprint) - - q = q.order_by('registrant__email') - - query = q.query - results = list(q) - - if include == []: - # default to include all fields - include = [i[0] for i in IC] - if results: - response = HttpResponse(mimetype='text/csv') - response['Content-Disposition'] = 'attachment; filename=registrations.csv' - output = csv.writer(response) - output.writerow([h for h in include]) - for row in results: - conference = row.conference == True and 'yes' or 'no' - tutorial = row.tutorial == True and 'yes' or 'no' - sprint = row.sprint == True and 'yes' or 'no' - wrow = [] - if 'Name' in include: - wrow.append( - row.registrant.get_full_name().encode('utf-8')) - if 'Email' in include: - wrow.append(row.registrant.email.encode('utf-8')) - if 'Organisation' in include: - wrow.append(row.organisation.encode('utf-8')) - if 'Conference' in include: - wrow.append(conference) - if 'Tutorial' in include: - wrow.append(tutorial) - if 'Sprint' in include: - wrow.append(sprint) - output.writerow(wrow) - return response - else: - no_results = u'No results found for the query' - else: - form = RegistrationAdminSelectForm() + q = Registration.objects.all() + conf_num = q.filter(conference=True).count() + tut_num = q.filter(tutorial=True).count() + sprint_num = q.filter(sprint=True).count() + return render_to_response(template_name, RequestContext(request, - locals())) + {'params': {'scope': scope}, + 'conf_num': conf_num, + 'tut_num': tut_num, + 'sprint_num': sprint_num, + }))
\ No newline at end of file diff --git a/project/static/css/styles.css b/project/static/css/styles.css index 312290e..4127bd0 100644 --- a/project/static/css/styles.css +++ b/project/static/css/styles.css @@ -113,6 +113,32 @@ table.scipycon-default th padding: 4px 6px; } +table.scipycon-default-border +{ + border-width: 2px; + border-spacing: 2px; + border-style: outset; + border-color: gray; + border-collapse: separate; +} + +table.scipycon-default-border td +{ + border-width: 1px; + padding: 5px 15px; + border-style: inset; + border-color: gray; +} + +table.scipycon-default-border th +{ + border-width: 1px; + border-style: inset; + border-color: gray; + font-weight: bold; + padding: 4px 6px; +} + table.scipycon-default a { text-decoration: none; |