# -*- coding: utf-8 -*-
from __future__ import absolute_import
from import_export.fields import Field
from import_export import resources
from apps.foundation.models import Option

class OptionResource(resources.ModelResource):

    def __init__(self):
        super(OptionResource, self).__init__()
        self.fields['name'] = Field(attribute='name')
        self.fields['type_text'] = Field(attribute='type_text')
        self.fields['enabled_text'] = Field(attribute='enabled_text')
        self.fields['notes'] = Field(attribute='notes')

    def get_export_headers(self):
        return [u'名称', u'类别', u'在用', u'备注',]

    class Meta:
        model = Option
        fields = ('name', 'type_text', 'enabled_text', 'notes',)
        export_order = fields
