forked from DGNum/gestioCOF
Compatibilité python 3
Rend GestioCOF compatible avec python 3. En particulier, il s'agit de : - Utiliser la version "fonction" de `print` dans `sync_clipper` et `tirage_bda`, avec le `from __future__ import print_function` pour garder la compatibilité avec python 2 - Utiliser de l'unicode par défaut, même en python 2, avec `from __future__ import unicode_literals` et le décorateur de compatibilité `python_2_unicode_compatible` de Django pour les modèles, comme décrit à https://docs.djangoproject.com/en/1.9/topics/python3/#str-and-unicode-methods - Utiliser `six.text_type` à la place de `unicode` Fixes #2.
This commit is contained in:
parent
7f61870236
commit
21b8b6042f
18 changed files with 174 additions and 81 deletions
18
bda/admin.py
18
bda/admin.py
|
@ -1,5 +1,7 @@
|
|||
# coding: utf-8
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.core.mail import send_mail
|
||||
|
||||
from django.contrib import admin
|
||||
|
@ -52,9 +54,9 @@ class ParticipantAdmin(admin.ModelAdmin):
|
|||
def total(self, obj):
|
||||
tot = obj.total
|
||||
if tot:
|
||||
return u"%.02f €" % tot
|
||||
return "%.02f €" % tot
|
||||
else:
|
||||
return u"0 €"
|
||||
return "0 €"
|
||||
total.admin_order_field = "total"
|
||||
total.short_description = "Total à payer"
|
||||
list_display = ("user", "nb_places", "total", "paid", "paymenttype",
|
||||
|
@ -70,7 +72,7 @@ class ParticipantAdmin(admin.ModelAdmin):
|
|||
for member in queryset.all():
|
||||
attribs = member.attributions.all()
|
||||
if len(attribs) == 0:
|
||||
mail = u"""Cher-e %s,
|
||||
mail = """Cher-e %s,
|
||||
|
||||
Tu t'es inscrit-e pour le tirage au sort du BdA. Malheureusement, tu n'as
|
||||
obtenu aucune place.
|
||||
|
@ -120,7 +122,7 @@ Le Bureau des Arts
|
|||
attribs_text = ""
|
||||
name = member.user.get_full_name()
|
||||
for attrib in attribs:
|
||||
attribs_text += u"- 1 place pour %s\n" % attrib
|
||||
attribs_text += "- 1 place pour %s\n" % attrib
|
||||
deadline = member.tirage.fermeture + timedelta(days=7)
|
||||
mail = mail % (name, attribs_text,
|
||||
deadline.strftime('%d %b %Y'))
|
||||
|
@ -129,14 +131,14 @@ Le Bureau des Arts
|
|||
fail_silently=True)
|
||||
count = len(queryset.all())
|
||||
if count == 1:
|
||||
message_bit = u"1 membre a"
|
||||
message_bit = "1 membre a"
|
||||
plural = ""
|
||||
else:
|
||||
message_bit = u"%d membres ont" % count
|
||||
message_bit = "%d membres ont" % count
|
||||
plural = "s"
|
||||
self.message_user(request, u"%s été informé%s avec succès."
|
||||
self.message_user(request, "%s été informé%s avec succès."
|
||||
% (message_bit, plural))
|
||||
send_attribs.short_description = u"Envoyer les résultats par mail"
|
||||
send_attribs.short_description = "Envoyer les résultats par mail"
|
||||
|
||||
|
||||
class AttributionAdminForm(forms.ModelForm):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue