Fix search

This commit is contained in:
Alexandre Iooss 2019-08-10 11:49:22 +02:00
parent 9ae8bfbe3f
commit 82ebc60982
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 5 additions and 4 deletions

View File

@ -15,7 +15,7 @@ class AuteurAdmin(VersionAdmin):
class MediaAdmin(VersionAdmin): class MediaAdmin(VersionAdmin):
list_display = ('titre', 'authors', 'cote') list_display = ('titre', 'authors', 'cote')
search_fields = ('titre', 'authors', 'cote') search_fields = ('titre', 'auteur__nom', 'cote')
autocomplete_fields = ('auteur',) autocomplete_fields = ('auteur',)
def authors(self, obj): def authors(self, obj):
@ -25,7 +25,8 @@ class MediaAdmin(VersionAdmin):
class EmpruntAdmin(VersionAdmin): class EmpruntAdmin(VersionAdmin):
list_display = ('media', 'user', 'date_emprunt', 'date_rendu', list_display = ('media', 'user', 'date_emprunt', 'date_rendu',
'permanencier_emprunt', 'permanencier_rendu') 'permanencier_emprunt', 'permanencier_rendu')
search_fields = ('media', 'user', 'date_emprunt', 'date_rendu') search_fields = ('media__titre', 'media__cote', 'user__username',
'date_emprunt', 'date_rendu')
date_hierarchy = 'date_emprunt' date_hierarchy = 'date_emprunt'
autocomplete_fields = ('media', 'user', 'permanencier_emprunt', autocomplete_fields = ('media', 'user', 'permanencier_emprunt',
'permanencier_rendu') 'permanencier_rendu')
@ -34,7 +35,7 @@ class EmpruntAdmin(VersionAdmin):
class JeuAdmin(VersionAdmin): class JeuAdmin(VersionAdmin):
list_display = ('nom', 'proprietaire', 'duree', 'nombre_joueurs_min', list_display = ('nom', 'proprietaire', 'duree', 'nombre_joueurs_min',
'nombre_joueurs_max', 'comment') 'nombre_joueurs_max', 'comment')
search_fields = ('nom', 'proprietaire', 'duree', 'comment') search_fields = ('nom', 'proprietaire__username', 'duree', 'comment')
autocomplete_fields = ('proprietaire',) autocomplete_fields = ('proprietaire',)

View File

@ -19,7 +19,7 @@ from .models import Adhesion, Clef, User
class ClefAdmin(VersionAdmin): class ClefAdmin(VersionAdmin):
list_display = ('nom', 'proprio', 'commentaire') list_display = ('nom', 'proprio', 'commentaire')
ordering = ('nom',) ordering = ('nom',)
search_fields = ('nom', 'proprio', 'commentaire') search_fields = ('nom', 'proprio__username', 'commentaire')
autocomplete_fields = ('proprio',) autocomplete_fields = ('proprio',)