Improve excel export of levels

This commit is contained in:
Gabriel Augendre 2019-06-28 15:50:47 +02:00
parent 4ee4b14b60
commit c2e9b9e86b

View file

@ -1,6 +1,7 @@
from django.contrib import admin, messages
from import_export import resources, fields
from import_export.admin import ExportMixin
from import_export.widgets import IntegerWidget, DecimalWidget
from manuels.models import Teacher, Book, Level, Editor, SuppliesRequirement, CommonSupply
@ -27,11 +28,11 @@ class TeacherAdmin(ExportMixin, admin.ModelAdmin):
class LevelResource(resources.ModelResource):
non_acquired_book_count = fields.Field(attribute='non_acquired_book_count')
non_acquired_book_price = fields.Field(attribute='non_acquired_book_price')
non_acquired_consumable_count = fields.Field(attribute='non_acquired_consumable_count')
non_acquired_consumable_price = fields.Field(attribute='non_acquired_consumable_price')
non_acquired_total_price = fields.Field(attribute='non_acquired_total_price')
non_acquired_book_count = fields.Field(attribute='non_acquired_book_count', widget=IntegerWidget())
non_acquired_book_price = fields.Field(attribute='non_acquired_book_price', widget=DecimalWidget())
non_acquired_consumable_count = fields.Field(attribute='non_acquired_consumable_count', widget=IntegerWidget())
non_acquired_consumable_price = fields.Field(attribute='non_acquired_consumable_price', widget=DecimalWidget())
non_acquired_total_price = fields.Field(attribute='non_acquired_total_price', widget=DecimalWidget())
class Meta:
model = Level