forked from DGNum/gestioCOF
PEP8: Forgot a few binops
This commit is contained in:
parent
6d68f6638f
commit
483ddf0f86
6 changed files with 17 additions and 18 deletions
|
@ -119,8 +119,8 @@ Le Bureau des Arts
|
||||||
else:
|
else:
|
||||||
message_bit = u"%d membres ont" % count
|
message_bit = u"%d membres ont" % count
|
||||||
plural = "s"
|
plural = "s"
|
||||||
self.message_user(request, u"%s été informé%s avec succès." %
|
self.message_user(request, u"%s été informé%s avec succès."
|
||||||
(message_bit, plural))
|
% (message_bit, plural))
|
||||||
send_attribs.short_description = u"Envoyer les résultats par mail"
|
send_attribs.short_description = u"Envoyer les résultats par mail"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ def add_link_field(target_model='', field='', link_text=unicode,
|
||||||
if not link_obj.id:
|
if not link_obj.id:
|
||||||
return ""
|
return ""
|
||||||
url = reverse(reverse_path, args=(link_obj.id,))
|
url = reverse(reverse_path, args=(link_obj.id,))
|
||||||
return mark_safe("<a href='%s'>%s</a>" %
|
return mark_safe("<a href='%s'>%s</a>"
|
||||||
(url, link_text(link_obj)))
|
% (url, link_text(link_obj)))
|
||||||
link.allow_tags = True
|
link.allow_tags = True
|
||||||
link.short_description = desc_text(reverse_name + ' link')
|
link.short_description = desc_text(reverse_name + ' link')
|
||||||
cls.link = link
|
cls.link = link
|
||||||
|
|
|
@ -7,8 +7,8 @@ from django.apps import apps
|
||||||
def export(qs, fields=None):
|
def export(qs, fields=None):
|
||||||
model = qs.model
|
model = qs.model
|
||||||
response = HttpResponse(content_type='text/csv')
|
response = HttpResponse(content_type='text/csv')
|
||||||
response['Content-Disposition'] = 'attachment; filename=%s.csv' %\
|
response['Content-Disposition'] = 'attachment; filename=%s.csv' \
|
||||||
slugify(model.__name__)
|
% slugify(model.__name__)
|
||||||
writer = csv.writer(response)
|
writer = csv.writer(response)
|
||||||
# Write headers to CSV file
|
# Write headers to CSV file
|
||||||
if fields:
|
if fields:
|
||||||
|
|
|
@ -108,8 +108,7 @@ class SurveyStatusFilterForm(forms.Form):
|
||||||
else:
|
else:
|
||||||
initial = "none"
|
initial = "none"
|
||||||
field = forms.ChoiceField(
|
field = forms.ChoiceField(
|
||||||
label="%s : %s" %
|
label="%s : %s" % (question.question, answer.answer),
|
||||||
(question.question, answer.answer),
|
|
||||||
choices=[("yes", "yes"), ("no", "no"), ("none", "none")],
|
choices=[("yes", "yes"), ("no", "no"), ("none", "none")],
|
||||||
widget=TriStateCheckbox,
|
widget=TriStateCheckbox,
|
||||||
required=False,
|
required=False,
|
||||||
|
|
|
@ -186,8 +186,8 @@ def _traitement_other_preparing(request, demande):
|
||||||
continue
|
continue
|
||||||
user = candidates[choice]
|
user = candidates[choice]
|
||||||
if user in proposals[matiere]:
|
if user in proposals[matiere]:
|
||||||
errors.append(u"La proposition %d en %s est un doublon" %
|
errors.append(u"La proposition %d en %s est un doublon"
|
||||||
(choice_id + 1, matiere))
|
% (choice_id + 1, matiere))
|
||||||
continue
|
continue
|
||||||
proposals[matiere].append(user)
|
proposals[matiere].append(user)
|
||||||
attribdata[matiere.id].append(user.id)
|
attribdata[matiere.id].append(user.id)
|
||||||
|
@ -198,10 +198,10 @@ def _traitement_other_preparing(request, demande):
|
||||||
if not proposals[matiere]:
|
if not proposals[matiere]:
|
||||||
errors.append(u"Aucune proposition pour %s" % (matiere,))
|
errors.append(u"Aucune proposition pour %s" % (matiere,))
|
||||||
elif len(proposals[matiere]) < 3:
|
elif len(proposals[matiere]) < 3:
|
||||||
errors.append(u"Seulement %d proposition%s pour %s" %
|
errors.append(u"Seulement %d proposition%s pour %s"
|
||||||
(len(proposals[matiere]), "s"
|
% (len(proposals[matiere]),
|
||||||
if len(proposals[matiere]) > 1 else "",
|
"s" if len(proposals[matiere]) > 1 else "",
|
||||||
matiere))
|
matiere))
|
||||||
else:
|
else:
|
||||||
unsatisfied.append(matiere)
|
unsatisfied.append(matiere)
|
||||||
return _finalize_traitement(request, demande, proposals, proposed_for,
|
return _finalize_traitement(request, demande, proposals, proposed_for,
|
||||||
|
|
|
@ -26,8 +26,8 @@ if __name__ == "__main__":
|
||||||
print "%d places" % available_slots
|
print "%d places" % available_slots
|
||||||
print "%d participants" % len(members)
|
print "%d participants" % len(members)
|
||||||
print "%d demandes" % len(choices)
|
print "%d demandes" % len(choices)
|
||||||
print "%d places demandées" % (len(choices) +
|
print "%d places demandées" % (len(choices)
|
||||||
len(choices.filter(double=True).all()))
|
+ len(choices.filter(double=True).all()))
|
||||||
print "%.02f€ à brasser" % total_price
|
print "%.02f€ à brasser" % total_price
|
||||||
print "Récupération: %.2fs" % (time.time() - start)
|
print "Récupération: %.2fs" % (time.time() - start)
|
||||||
start_init = time.time()
|
start_init = time.time()
|
||||||
|
@ -57,8 +57,8 @@ if __name__ == "__main__":
|
||||||
members2[member].append(show)
|
members2[member].append(show)
|
||||||
member.total += show.price
|
member.total += show.price
|
||||||
if len(members) < show.slots:
|
if len(members) < show.slots:
|
||||||
print "%d place(s) invendue(s) pour %s" %\
|
print "%d place(s) invendue(s) pour %s" \
|
||||||
(show.slots - len(members), show)
|
% (show.slots - len(members), show)
|
||||||
members2 = members2.items()
|
members2 = members2.items()
|
||||||
print "Temps total: %.2fs" % (time.time() - start)
|
print "Temps total: %.2fs" % (time.time() - start)
|
||||||
print "Requêtes SQL:"
|
print "Requêtes SQL:"
|
||||||
|
|
Loading…
Reference in a new issue