diff --git a/symposion/proposals/actions.py b/symposion/proposals/actions.py index b48ac34f..e46e2524 100644 --- a/symposion/proposals/actions.py +++ b/symposion/proposals/actions.py @@ -3,11 +3,12 @@ import csv from django.http import HttpResponse -def export_as_csv_action(description="Export selected objects as CSV file", - fields=None, exclude=None, header=True): +def export_as_csv_action( + description="Export selected objects as CSV file", + fields=None, exclude=None, header=True): """ This function returns an export csv action - 'fields' and 'exclude' work like in django ModelForm + 'fields' and 'exclude' work like in Django ModelForm 'header' is whether or not to output the column names as the first row """ def export_as_csv(modeladmin, request, queryset): @@ -22,10 +23,8 @@ def export_as_csv_action(description="Export selected objects as CSV file", elif exclude: excludeset = set(exclude) field_names = field_names - excludeset - - response = HttpResponse(mimetype='text/csv') - response['Content-Disposition'] = 'attachment; filename=%s.csv' % unicode(opts).replace('.', '_') - + response = HttpResponse(mimetype="text/csv") + response["Content-Disposition"] = "attachment; filename=%s.csv" % unicode(opts).replace(".", "_") writer = csv.writer(response) if header: writer.writerow(list(field_names)) diff --git a/symposion/proposals/views.py b/symposion/proposals/views.py index 8bc5336e..cf532c2b 100644 --- a/symposion/proposals/views.py +++ b/symposion/proposals/views.py @@ -23,7 +23,7 @@ from symposion.proposals.forms import AddSpeakerForm, SupportingDocumentCreateFo def get_form(name): - dot = name.rindex('.') + dot = name.rindex(".") mod_name, form_name = name[:dot], name[dot + 1:] __import__(mod_name) return getattr(sys.modules[mod_name], form_name) diff --git a/symposion/reviews/templatetags/review_tags.py b/symposion/reviews/templatetags/review_tags.py index 9a73f878..cfb6437e 100644 --- a/symposion/reviews/templatetags/review_tags.py +++ b/symposion/reviews/templatetags/review_tags.py @@ -5,6 +5,7 @@ from symposion.reviews.models import Review, ReviewAssignment register = template.Library() + @register.assignment_tag(takes_context=True) def review_assignments(context): request = context["request"] diff --git a/symposion/reviews/views.py b/symposion/reviews/views.py index 56ad0e87..880e9e8b 100644 --- a/symposion/reviews/views.py +++ b/symposion/reviews/views.py @@ -65,7 +65,7 @@ def proposals_generator(request, queryset, user_pk=None, check_speaker=True): # Returns a list of all proposals, proposals reviewed by the user, or the proposals the user has yet to review # depending on the link user clicks in dashboard @login_required -def review_section(request, section_slug, assigned=False, reviewed='all'): +def review_section(request, section_slug, assigned=False, reviewed="all"): if not request.user.has_perm("reviews.can_review_%s" % section_slug): return access_not_permitted(request) @@ -76,18 +76,19 @@ def review_section(request, section_slug, assigned=False, reviewed='all'): if assigned: assignments = ReviewAssignment.objects.filter(user=request.user).values_list("proposal__id") queryset = queryset.filter(id__in=assignments) - -# passing reviewed in from reviews.urls and out to review_list for appropriate template header rendering - if reviewed == 'all': + + # passing reviewed in from reviews.urls and out to review_list for + # appropriate template header rendering + if reviewed == "all": queryset = queryset.select_related("result").select_subclasses() - reviewed = 'all_reviews' - elif reviewed == 'reviewed': + reviewed = "all_reviews" + elif reviewed == "reviewed": queryset = queryset.filter(reviews__user=request.user) - reviewed = 'user_reviewed' + reviewed = "user_reviewed" else: queryset = queryset.exclude(reviews__user=request.user).exclude(speaker=request.user) - reviewed = 'user_not_reviewed' - + reviewed = "user_not_reviewed" + proposals = proposals_generator(request, queryset) ctx = { diff --git a/symposion/sponsorship/models.py b/symposion/sponsorship/models.py index 2afa42db..a01f4f47 100644 --- a/symposion/sponsorship/models.py +++ b/symposion/sponsorship/models.py @@ -48,7 +48,7 @@ class Sponsor(models.Model): # Denormalization (this assumes only one logo) sponsor_logo = models.ForeignKey("SponsorBenefit", related_name="+", null=True, blank=True, editable=False) - + objects = SponsorManager() def __unicode__(self): @@ -121,7 +121,7 @@ class Sponsor(models.Model): # Any remaining sponsor benefits that don't normally belong to # this level are set to inactive self.sponsor_benefits.exclude(pk__in=allowed_benefits).update(active=False, max_words=None, other_limits="") - + def send_coordinator_emails(self): pass # @@@ should this just be done centrally? @@ -160,7 +160,7 @@ class BenefitLevel(models.Model): benefit = models.ForeignKey(Benefit, related_name="benefit_levels", verbose_name=_("benefit")) level = models.ForeignKey(SponsorLevel, related_name="benefit_levels", verbose_name=_("level")) - + # default limits for this benefit at given level max_words = models.PositiveIntegerField(_("max words"), blank=True, null=True) other_limits = models.CharField(_("other limits"), max_length=200, blank=True) @@ -188,7 +188,7 @@ class SponsorBenefit(models.Model): upload = models.FileField(_("file"), blank=True, upload_to="sponsor_files") class Meta: - ordering = ['-active'] + ordering = ["-active"] def __unicode__(self): return u"%s - %s" % (self.sponsor, self.benefit)