3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-25 04:43:11 +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')
ordering = ('-date', )
search_fields = ('customer', 'product')
search_fields = ('customer__username', 'customer__first_name', 'customer__last_name', 'product__name')
list_filter = ('paymentMethod',)
class KegAdmin(SimpleHistoryAdmin):
@ -35,7 +35,7 @@ class KegHistoryAdmin(SimpleHistoryAdmin):
"""
list_display = ('keg', 'openingDate', 'closingDate', 'isCurrentKegHistory', 'quantitySold')
ordering = ('-openingDate', 'quantitySold')
search_fields = ('keg',)
search_fields = ('keg__name',)
list_filter = ('isCurrentKegHistory', 'keg')
class MenuHistoryAdmin(SimpleHistoryAdmin):
@ -70,7 +70,7 @@ class ReloadAdmin(SimpleHistoryAdmin):
"""
list_display = ('customer', 'amount', 'date', 'PaymentMethod')
ordering = ('-date', 'amount', 'customer')
search_fields = ('customer',)
search_fields = ('customer__username', 'customer__first_name', 'customer__last_name')
list_filter = ('PaymentMethod', )
class RefundAdmin(SimpleHistoryAdmin):
@ -79,7 +79,7 @@ class RefundAdmin(SimpleHistoryAdmin):
"""
list_display = ('customer', 'amount', 'date')
ordering = ('-date', 'amount', 'customer')
search_fields = ('customer',)
search_fields = ('customer__username', 'customer__first_name', 'customer__last_name')
class CategoryAdmin(SimpleHistoryAdmin):
"""

View file

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