Merge remote-tracking branch 'origin/master' into Aufinal/admin_logout

This commit is contained in:
ludo 2016-06-23 18:10:28 +02:00
commit b550acf071
5 changed files with 12 additions and 10 deletions

View file

@ -16,7 +16,6 @@ class AttributionInline(admin.TabularInline):
model = Attribution model = Attribution
class ParticipantAdmin(admin.ModelAdmin): class ParticipantAdmin(admin.ModelAdmin):
#inlines = [ChoixSpectacleInline]
inlines = [AttributionInline] inlines = [AttributionInline]
def get_queryset(self, request): def get_queryset(self, request):
return Participant.objects.annotate(nb_places = Count('attributions'), return Participant.objects.annotate(nb_places = Count('attributions'),
@ -31,8 +30,9 @@ class ParticipantAdmin(admin.ModelAdmin):
else: return u"0 €" else: return u"0 €"
total.admin_order_field = "total" total.admin_order_field = "total"
total.short_description = "Total à payer" total.short_description = "Total à payer"
list_display = ("user", "nb_places", "total", "paid", "paymenttype") list_display = ("user", "nb_places", "total", "paid", "paymenttype",
list_filter = ("paid",) "tirage")
list_filter = ("paid", "tirage")
search_fields = ('user__username', 'user__first_name', 'user__last_name') search_fields = ('user__username', 'user__first_name', 'user__last_name')
actions = ['send_attribs',] actions = ['send_attribs',]
actions_on_bottom = True actions_on_bottom = True

View file

@ -237,7 +237,9 @@ def do_tirage(request, tirage_id):
# FIXME: Établir les conditions de validations (formulaire ?) # FIXME: Établir les conditions de validations (formulaire ?)
# cf. issue #32 # cf. issue #32
if False: if False:
Attribution.objects.all().delete() Attribution.objects.filter(
spectacle__tirage=tirage_elt
).delete()
for (show, members, _) in results: for (show, members, _) in results:
for (member, _, _, _) in members: for (member, _, _, _) in members:
attrib = Attribution(spectacle=show, participant=member) attrib = Attribution(spectacle=show, participant=member)

View file

@ -79,6 +79,11 @@ class SurveyForm(forms.Form):
field.question_id = question.id field.question_id = question.id
self.fields["question_%d" % question.id] = field self.fields["question_%d" % question.id] = field
def answers(self):
for name, value in self.cleaned_data.items():
if name.startswith('question_'):
yield (self.fields[name].question_id, value)
class SurveyStatusFilterForm(forms.Form): class SurveyStatusFilterForm(forms.Form):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
survey = kwargs.pop("survey") survey = kwargs.pop("survey")

View file

@ -20,7 +20,7 @@
<td>{% for matiere in demande.matieres.all %}{% if forloop.counter0 > 0 %}, {% endif %}{{ matiere }}{% endfor %}</td> <td>{% for matiere in demande.matieres.all %}{% if forloop.counter0 > 0 %}, {% endif %}{{ matiere }}{% endfor %}</td>
<td>{{ demande.created|date:"d E Y" }}</td> <td>{{ demande.created|date:"d E Y" }}</td>
<td style="text-align: center;"><img src="{% if demande.traitee %}{% static "images/yes.png" %}{% else %}{% static "images/no.png" %}{% endif %}" /></td> <td style="text-align: center;"><img src="{% if demande.traitee %}{% static "images/yes.png" %}{% else %}{% static "images/no.png" %}{% endif %}" /></td>
<td>{% if demande.traitee_par %}{{ demande.traitee_par.username }}{% else %}<img src="{% static "/images/none.png" %}" />{% endif %}</td> <td>{% if demande.traitee_par %}{{ demande.traitee_par.username }}{% else %}<img src="{% static "images/none.png" %}" />{% endif %}</td>
<td><a href="{% url "petits-cours-demande-details" demande.id %}" class="see_detail">Détails</a></td> <td><a href="{% url "petits-cours-demande-details" demande.id %}" class="see_detail">Détails</a></td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -59,11 +59,6 @@ def logout(request):
else: else:
return redirect("django.contrib.auth.views.logout") return redirect("django.contrib.auth.views.logout")
def answers(self):
for name, value in self.cleaned_data.items():
if name.startswith('question_'):
yield (self.fields[name].question_id, value)
@login_required @login_required
def survey(request, survey_id): def survey(request, survey_id):
survey = get_object_or_404(Survey, id = survey_id) survey = get_object_or_404(Survey, id = survey_id)