forked from DGNum/gestioCOF
PEP8: fixed ' = ' → '=' on parameters
'unexpected spaces around keyword / parameter equals'
This commit is contained in:
parent
7de11f2285
commit
c7a3656ded
18 changed files with 496 additions and 379 deletions
16
bda/admin.py
16
bda/admin.py
|
@ -19,23 +19,25 @@ class AttributionInline(admin.TabularInline):
|
|||
class ParticipantAdmin(admin.ModelAdmin):
|
||||
inlines = [AttributionInline]
|
||||
def get_queryset(self, request):
|
||||
return Participant.objects.annotate(nb_places = Count('attributions'),
|
||||
total = Sum('attributions__price'))
|
||||
return Participant.objects.annotate(nb_places=Count('attributions'),
|
||||
total=Sum('attributions__price'))
|
||||
def nb_places(self, obj):
|
||||
return obj.nb_places
|
||||
nb_places.admin_order_field = "nb_places"
|
||||
nb_places.short_description = "Nombre de places"
|
||||
def total(self, obj):
|
||||
tot = obj.total
|
||||
if tot: return u"%.02f €" % tot
|
||||
else: return u"0 €"
|
||||
if tot:
|
||||
return u"%.02f €" % tot
|
||||
else:
|
||||
return u"0 €"
|
||||
total.admin_order_field = "total"
|
||||
total.short_description = "Total à payer"
|
||||
list_display = ("user", "nb_places", "total", "paid", "paymenttype",
|
||||
"tirage")
|
||||
list_filter = ("paid", "tirage")
|
||||
search_fields = ('user__username', 'user__first_name', 'user__last_name')
|
||||
actions = ['send_attribs',]
|
||||
actions = ['send_attribs', ]
|
||||
actions_on_bottom = True
|
||||
list_per_page = 400
|
||||
readonly_fields = ("total",)
|
||||
|
@ -97,7 +99,7 @@ Le Bureau des Arts
|
|||
mail = mail % (name, attribs_text, deadline.strftime('%d %b %Y'))
|
||||
send_mail ("Résultats du tirage au sort", mail,
|
||||
"bda@ens.fr", [member.user.email],
|
||||
fail_silently = True)
|
||||
fail_silently=True)
|
||||
count = len(queryset.all())
|
||||
if count == 1:
|
||||
message_bit = u"1 membre a"
|
||||
|
@ -110,7 +112,7 @@ Le Bureau des Arts
|
|||
|
||||
class AttributionAdminForm(forms.ModelForm):
|
||||
def clean(self):
|
||||
cleaned_data=super(AttributionAdminForm, self).clean()
|
||||
cleaned_data = super(AttributionAdminForm, self).clean()
|
||||
participant = cleaned_data.get("participant")
|
||||
spectacle = cleaned_data.get("spectacle")
|
||||
if participant and spectacle:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue