ajoute des filtres pour les voeux et spectacles

This commit is contained in:
ludo 2016-06-27 13:18:58 +02:00
parent 442f358cf5
commit dc02e9cd45
2 changed files with 8 additions and 5 deletions

View file

@ -116,6 +116,7 @@ class AttributionAdminForm(forms.ModelForm):
if participant and spectacle:
if participant.tirage != spectacle.tirage:
raise forms.ValidationError(u"Erreur : le participant et le spectacle n'appartiennent pas au même tirage")
return cleaned_data
class AttributionAdmin(admin.ModelAdmin):
def paid(self, obj):
@ -129,14 +130,16 @@ class AttributionAdmin(admin.ModelAdmin):
import autocomplete_light
class ChoixSpectacleAdmin(admin.ModelAdmin):
form = autocomplete_light.modelform_factory(ChoixSpectacle, exclude=[])
list_display = ("participant", "spectacle", "priority", "double_choice")
list_filter = ("double_choice",)
def tirage(self, obj):
return obj.participant.tirage
list_display = ("participant", "tirage", "spectacle", "priority", "double_choice")
list_filter = ("double_choice", "participant__tirage")
search_fields = ('participant__user__username', 'participant__user__first_name', 'participant__user__last_name')
class SpectacleAdmin(admin.ModelAdmin):
model = Spectacle
list_display = ("title", "date", "location", "slots", "price")
list_filter = ("location",)
list_display = ("title", "date", "tirage", "location", "slots", "price")
list_filter = ("location", "tirage",)
search_fields = ("title", "location__name")
class TirageAdmin(admin.ModelAdmin):

View file

@ -75,7 +75,7 @@ class Participant(models.Model):
tirage = models.ForeignKey(Tirage)
def __unicode__ (self):
return u"%s, %s" % (self.user, self.tirage.title)
return u"%s" % (self.user)
DOUBLE_CHOICES = (
("1", "1 place"),