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

This commit is contained in:
ludo 2016-06-24 14:51:31 +02:00
commit 20f3030552
8 changed files with 27 additions and 10 deletions

View file

@ -162,3 +162,10 @@ Pour mettre à jour les paquets Python, utiliser la commande suivante :
Pour mettre à jour les modèles après une migration, il faut ensuite faire : Pour mettre à jour les modèles après une migration, il faut ensuite faire :
python manage.py migrate python manage.py migrate
## Documentation utilisateur
Une brève documentation utilisateur pour se faliliariser plus vite avec l'outil
est accessible sur le
[wiki](https://git.eleves.ens.fr/cof-geek/gestioCOF/wikis/home).

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

@ -241,7 +241,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

@ -53,6 +53,7 @@ urlpatterns = patterns('',
url(r'^autocomplete/registration$', 'gestioncof.autocomplete.autocomplete'), url(r'^autocomplete/registration$', 'gestioncof.autocomplete.autocomplete'),
url(r'^autocomplete/', include('autocomplete_light.urls')), url(r'^autocomplete/', include('autocomplete_light.urls')),
# Interface admin # Interface admin
url(r'^admin/logout/', 'gestioncof.views.logout'),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/(?P<app_label>[\d\w]+)/(?P<model_name>[\d\w]+)/csv/', url(r'^admin/(?P<app_label>[\d\w]+)/(?P<model_name>[\d\w]+)/csv/',
'gestioncof.csv_views.admin_list_export', 'gestioncof.csv_views.admin_list_export',

View file

@ -154,6 +154,13 @@ class PetitCoursAttributionCounterAdmin(admin.ModelAdmin):
list_display = ('user','matiere','count',) list_display = ('user','matiere','count',)
list_filter = ('matiere',) list_filter = ('matiere',)
search_fields = ('user__username', 'user__first_name', 'user__last_name', 'user__email', 'matiere__name') search_fields = ('user__username', 'user__first_name', 'user__last_name', 'user__email', 'matiere__name')
actions = ['reset',]
actions_on_bottom = True
def reset(self, request, queryset):
queryset.update(count=0)
reset.short_description = u"Remise à zéro du compteur"
class PetitCoursDemandeAdmin(admin.ModelAdmin): class PetitCoursDemandeAdmin(admin.ModelAdmin):
list_display = ('name','email','agrege_requis','niveau','created','traitee','processed') list_display = ('name','email','agrege_requis','niveau','created','traitee','processed')

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)