Étend les champs de recherche dans l'admin

Fixes #24
This commit is contained in:
Martin Pépin 2016-07-13 01:01:07 +02:00
parent ec2079c417
commit 89590b88de
2 changed files with 19 additions and 2 deletions

View file

@ -174,7 +174,8 @@ class ChoixSpectacleAdmin(admin.ModelAdmin):
list_filter = ("double_choice", "participant__tirage") list_filter = ("double_choice", "participant__tirage")
search_fields = ('participant__user__username', search_fields = ('participant__user__username',
'participant__user__first_name', 'participant__user__first_name',
'participant__user__last_name') 'participant__user__last_name',
'spectacle__title')
class SpectacleAdmin(admin.ModelAdmin): class SpectacleAdmin(admin.ModelAdmin):
@ -193,8 +194,14 @@ class TirageAdmin(admin.ModelAdmin):
list_filter = ("active", ) list_filter = ("active", )
search_fields = ("title", ) search_fields = ("title", )
class SalleAdmin(admin.ModelAdmin):
model = Salle
search_fields = ('name', 'address')
admin.site.register(Spectacle, SpectacleAdmin) admin.site.register(Spectacle, SpectacleAdmin)
admin.site.register(Salle) admin.site.register(Salle, SalleAdmin)
admin.site.register(Participant, ParticipantAdmin) admin.site.register(Participant, ParticipantAdmin)
admin.site.register(Attribution, AttributionAdmin) admin.site.register(Attribution, AttributionAdmin)
admin.site.register(ChoixSpectacle, ChoixSpectacleAdmin) admin.site.register(ChoixSpectacle, ChoixSpectacleAdmin)

View file

@ -46,12 +46,14 @@ class SurveyQuestionInline(admin.TabularInline):
class SurveyQuestionAdmin(admin.ModelAdmin): class SurveyQuestionAdmin(admin.ModelAdmin):
search_fields = ('survey__title', 'answer')
inlines = [ inlines = [
SurveyQuestionAnswerInline, SurveyQuestionAnswerInline,
] ]
class SurveyAdmin(admin.ModelAdmin): class SurveyAdmin(admin.ModelAdmin):
search_fields = ('title', 'details')
inlines = [ inlines = [
SurveyQuestionInline, SurveyQuestionInline,
] ]
@ -72,12 +74,14 @@ class EventCommentFieldInline(admin.TabularInline):
class EventOptionAdmin(admin.ModelAdmin): class EventOptionAdmin(admin.ModelAdmin):
search_fields = ('event__title', 'name')
inlines = [ inlines = [
EventOptionChoiceInline, EventOptionChoiceInline,
] ]
class EventAdmin(admin.ModelAdmin): class EventAdmin(admin.ModelAdmin):
search_fields = ('title', 'location', 'description')
inlines = [ inlines = [
EventOptionInline, EventOptionInline,
EventCommentFieldInline, EventCommentFieldInline,
@ -189,6 +193,7 @@ class PetitCoursAbilityAdmin(admin.ModelAdmin):
class PetitCoursAttributionAdmin(admin.ModelAdmin): class PetitCoursAttributionAdmin(admin.ModelAdmin):
list_display = ('user', 'demande', 'matiere', 'rank', ) list_display = ('user', 'demande', 'matiere', 'rank', )
search_fields = ('user__username', 'matiere__name')
class PetitCoursAttributionCounterAdmin(admin.ModelAdmin): class PetitCoursAttributionCounterAdmin(admin.ModelAdmin):
@ -208,6 +213,11 @@ class PetitCoursDemandeAdmin(admin.ModelAdmin):
list_display = ('name', 'email', 'agrege_requis', 'niveau', 'created', list_display = ('name', 'email', 'agrege_requis', 'niveau', 'created',
'traitee', 'processed') 'traitee', 'processed')
list_filter = ('traitee', 'niveau') list_filter = ('traitee', 'niveau')
search_fields = ('name', 'email', 'phone', 'lieu', 'remarques')
class CustomMailAdmin(admin.ModelAdmin):
search_fields = ('shortname', 'title')
admin.site.register(Survey, SurveyAdmin) admin.site.register(Survey, SurveyAdmin)
admin.site.register(SurveyQuestion, SurveyQuestionAdmin) admin.site.register(SurveyQuestion, SurveyQuestionAdmin)