ajoute des filtres pour les voeux et spectacles
This commit is contained in:
parent
442f358cf5
commit
dc02e9cd45
2 changed files with 8 additions and 5 deletions
11
bda/admin.py
11
bda/admin.py
|
@ -116,6 +116,7 @@ class AttributionAdminForm(forms.ModelForm):
|
||||||
if participant and spectacle:
|
if participant and spectacle:
|
||||||
if participant.tirage != spectacle.tirage:
|
if participant.tirage != spectacle.tirage:
|
||||||
raise forms.ValidationError(u"Erreur : le participant et le spectacle n'appartiennent pas au même 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):
|
class AttributionAdmin(admin.ModelAdmin):
|
||||||
def paid(self, obj):
|
def paid(self, obj):
|
||||||
|
@ -129,14 +130,16 @@ class AttributionAdmin(admin.ModelAdmin):
|
||||||
import autocomplete_light
|
import autocomplete_light
|
||||||
class ChoixSpectacleAdmin(admin.ModelAdmin):
|
class ChoixSpectacleAdmin(admin.ModelAdmin):
|
||||||
form = autocomplete_light.modelform_factory(ChoixSpectacle, exclude=[])
|
form = autocomplete_light.modelform_factory(ChoixSpectacle, exclude=[])
|
||||||
list_display = ("participant", "spectacle", "priority", "double_choice")
|
def tirage(self, obj):
|
||||||
list_filter = ("double_choice",)
|
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')
|
search_fields = ('participant__user__username', 'participant__user__first_name', 'participant__user__last_name')
|
||||||
|
|
||||||
class SpectacleAdmin(admin.ModelAdmin):
|
class SpectacleAdmin(admin.ModelAdmin):
|
||||||
model = Spectacle
|
model = Spectacle
|
||||||
list_display = ("title", "date", "location", "slots", "price")
|
list_display = ("title", "date", "tirage", "location", "slots", "price")
|
||||||
list_filter = ("location",)
|
list_filter = ("location", "tirage",)
|
||||||
search_fields = ("title", "location__name")
|
search_fields = ("title", "location__name")
|
||||||
|
|
||||||
class TirageAdmin(admin.ModelAdmin):
|
class TirageAdmin(admin.ModelAdmin):
|
||||||
|
|
|
@ -75,7 +75,7 @@ class Participant(models.Model):
|
||||||
tirage = models.ForeignKey(Tirage)
|
tirage = models.ForeignKey(Tirage)
|
||||||
|
|
||||||
def __unicode__ (self):
|
def __unicode__ (self):
|
||||||
return u"%s, %s" % (self.user, self.tirage.title)
|
return u"%s" % (self.user)
|
||||||
|
|
||||||
DOUBLE_CHOICES = (
|
DOUBLE_CHOICES = (
|
||||||
("1", "1 place"),
|
("1", "1 place"),
|
||||||
|
|
Loading…
Reference in a new issue