forked from DGNum/gestioCOF
Merge branch 'master' into Kerl/fix_32_do_tirage
This commit is contained in:
commit
87da29ee59
12 changed files with 246 additions and 83 deletions
32
bda/admin.py
32
bda/admin.py
|
@ -20,10 +20,25 @@ class ChoixSpectacleInline(admin.TabularInline):
|
|||
|
||||
class AttributionInline(admin.TabularInline):
|
||||
model = Attribution
|
||||
extra = 0
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super(AttributionInline, self).get_queryset(request)
|
||||
return qs.filter(spectacle__listing=False)
|
||||
|
||||
|
||||
class AttributionInlineListing(admin.TabularInline):
|
||||
model = Attribution
|
||||
exclude = ('given', )
|
||||
extra = 0
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super(AttributionInlineListing, self).get_queryset(request)
|
||||
return qs.filter(spectacle__listing=True)
|
||||
|
||||
|
||||
class ParticipantAdmin(admin.ModelAdmin):
|
||||
inlines = [AttributionInline]
|
||||
inlines = [AttributionInline, AttributionInlineListing]
|
||||
|
||||
def get_queryset(self, request):
|
||||
return Participant.objects.annotate(nb_places=Count('attributions'),
|
||||
|
@ -159,14 +174,17 @@ class ChoixSpectacleAdmin(admin.ModelAdmin):
|
|||
list_filter = ("double_choice", "participant__tirage")
|
||||
search_fields = ('participant__user__username',
|
||||
'participant__user__first_name',
|
||||
'participant__user__last_name')
|
||||
'participant__user__last_name',
|
||||
'spectacle__title')
|
||||
|
||||
|
||||
class SpectacleAdmin(admin.ModelAdmin):
|
||||
model = Spectacle
|
||||
list_display = ("title", "date", "tirage", "location", "slots", "price")
|
||||
list_display = ("title", "date", "tirage", "location", "slots", "price",
|
||||
"listing")
|
||||
list_filter = ("location", "tirage",)
|
||||
search_fields = ("title", "location__name")
|
||||
readonly_fields = ("rappel_sent", )
|
||||
|
||||
|
||||
class TirageAdmin(admin.ModelAdmin):
|
||||
|
@ -177,8 +195,14 @@ class TirageAdmin(admin.ModelAdmin):
|
|||
list_filter = ("active", )
|
||||
search_fields = ("title", )
|
||||
|
||||
|
||||
class SalleAdmin(admin.ModelAdmin):
|
||||
model = Salle
|
||||
search_fields = ('name', 'address')
|
||||
|
||||
|
||||
admin.site.register(Spectacle, SpectacleAdmin)
|
||||
admin.site.register(Salle)
|
||||
admin.site.register(Salle, SalleAdmin)
|
||||
admin.site.register(Participant, ParticipantAdmin)
|
||||
admin.site.register(Attribution, AttributionAdmin)
|
||||
admin.site.register(ChoixSpectacle, ChoixSpectacleAdmin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue