3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-12-24 16:03:47 +00:00

Fix search in admin

This commit is contained in:
Yoann Pétri 2019-06-23 11:02:37 +02:00
parent 0fd8f2d419
commit 188b278532
2 changed files with 7 additions and 7 deletions

View file

@ -17,7 +17,7 @@ class ConsumptionHistoryAdmin(SimpleHistoryAdmin):
""" """
list_display = ('customer', 'product', 'quantity', 'paymentMethod', 'date', 'amount') list_display = ('customer', 'product', 'quantity', 'paymentMethod', 'date', 'amount')
ordering = ('-date', ) ordering = ('-date', )
search_fields = ('customer', 'product') search_fields = ('customer__username', 'customer__first_name', 'customer__last_name', 'product__name')
list_filter = ('paymentMethod',) list_filter = ('paymentMethod',)
class KegAdmin(SimpleHistoryAdmin): class KegAdmin(SimpleHistoryAdmin):
@ -35,7 +35,7 @@ class KegHistoryAdmin(SimpleHistoryAdmin):
""" """
list_display = ('keg', 'openingDate', 'closingDate', 'isCurrentKegHistory', 'quantitySold') list_display = ('keg', 'openingDate', 'closingDate', 'isCurrentKegHistory', 'quantitySold')
ordering = ('-openingDate', 'quantitySold') ordering = ('-openingDate', 'quantitySold')
search_fields = ('keg',) search_fields = ('keg__name',)
list_filter = ('isCurrentKegHistory', 'keg') list_filter = ('isCurrentKegHistory', 'keg')
class MenuHistoryAdmin(SimpleHistoryAdmin): class MenuHistoryAdmin(SimpleHistoryAdmin):
@ -70,7 +70,7 @@ class ReloadAdmin(SimpleHistoryAdmin):
""" """
list_display = ('customer', 'amount', 'date', 'PaymentMethod') list_display = ('customer', 'amount', 'date', 'PaymentMethod')
ordering = ('-date', 'amount', 'customer') ordering = ('-date', 'amount', 'customer')
search_fields = ('customer',) search_fields = ('customer__username', 'customer__first_name', 'customer__last_name')
list_filter = ('PaymentMethod', ) list_filter = ('PaymentMethod', )
class RefundAdmin(SimpleHistoryAdmin): class RefundAdmin(SimpleHistoryAdmin):
@ -79,7 +79,7 @@ class RefundAdmin(SimpleHistoryAdmin):
""" """
list_display = ('customer', 'amount', 'date') list_display = ('customer', 'amount', 'date')
ordering = ('-date', 'amount', 'customer') ordering = ('-date', 'amount', 'customer')
search_fields = ('customer',) search_fields = ('customer__username', 'customer__first_name', 'customer__last_name')
class CategoryAdmin(SimpleHistoryAdmin): class CategoryAdmin(SimpleHistoryAdmin):
""" """

View file

@ -11,7 +11,7 @@ class CotisationHistoryAdmin(SimpleHistoryAdmin):
""" """
list_display = ('user', 'amount', 'duration', 'paymentDate', 'endDate', 'paymentMethod') list_display = ('user', 'amount', 'duration', 'paymentDate', 'endDate', 'paymentMethod')
ordering = ('user', 'amount', 'duration', 'paymentDate', 'endDate') ordering = ('user', 'amount', 'duration', 'paymentDate', 'endDate')
search_fields = ('user',) search_fields = ('user__username', 'user__first_name', 'user__last_name')
list_filter = ('paymentMethod', ) list_filter = ('paymentMethod', )
class BalanceFilter(admin.SimpleListFilter): class BalanceFilter(admin.SimpleListFilter):
@ -43,7 +43,7 @@ class ProfileAdmin(SimpleHistoryAdmin):
""" """
list_display = ('user', 'credit', 'debit', 'balance', 'school', 'cotisationEnd', 'is_adherent') list_display = ('user', 'credit', 'debit', 'balance', 'school', 'cotisationEnd', 'is_adherent')
ordering = ('user', '-credit', '-debit') ordering = ('user', '-credit', '-debit')
search_fields = ('user',) search_fields = ('user__username', 'user__first_name', 'user__last_name')
list_filter = ('school', BalanceFilter) list_filter = ('school', BalanceFilter)
class WhiteListHistoryAdmin(SimpleHistoryAdmin): class WhiteListHistoryAdmin(SimpleHistoryAdmin):
@ -52,7 +52,7 @@ class WhiteListHistoryAdmin(SimpleHistoryAdmin):
""" """
list_display = ('user', 'paymentDate', 'endDate', 'duration') list_display = ('user', 'paymentDate', 'endDate', 'duration')
ordering = ('user', 'duration', 'paymentDate', 'endDate') ordering = ('user', 'duration', 'paymentDate', 'endDate')
search_fields = ('user',) search_fields = ('user__username', 'user__first_name', 'user__last_name')
admin.site.register(Permission, SimpleHistoryAdmin) admin.site.register(Permission, SimpleHistoryAdmin)
admin.site.register(School, SimpleHistoryAdmin) admin.site.register(School, SimpleHistoryAdmin)