diff --git a/manuels/admin.py b/manuels/admin.py index 8dee69e..3fc91ef 100644 --- a/manuels/admin.py +++ b/manuels/admin.py @@ -26,9 +26,15 @@ class TeacherAdmin(ExportMixin, admin.ModelAdmin): actions = [send_link] +class TeacherResource(resources.ModelResource): + class Meta: + model = Teacher + fields = ('first_name', 'last_name', 'email', 'phone_number') + + @admin.register(Level) class LevelAdmin(admin.ModelAdmin): - list_display = ['name', 'order', 'consumable_count', 'consumable_price'] + list_display = ['name', 'order', 'book_count', 'consumable_count', 'consumable_price'] list_editable = ['order'] list_display_links = ['name'] @@ -36,6 +42,10 @@ class LevelAdmin(admin.ModelAdmin): return obj.consumable_count consumable_count.short_description = 'Nombre de consommable(s)' + def book_count(self, obj: Level): + return obj.book_set.count() + book_count.short_description = 'Nombre de livre(s)' + def consumable_price(self, obj: Level): return f'{obj.consumable_price:.2f}€' consumable_price.short_description = 'Coût des consommables'