# Path: mtr/sync/lib/helpers.py
# def cell_value(row, cols, processor=None):
# def column_name(index):
# def column_index(value):
# def model_fields(model, settings=None):
# def model_attributes(settings, prefix=None, model=None, parent=None, level=0):
# def make_model_class(settings):
# def _process_fk_attribute(model, attribute):
# def _process_mtm_attribute(model, attribute):
# def process_attribute(model, attribute):
# 
# Path: mtr/sync/settings.py
# SETTINGS = getattr_with_prefix('SYNC', 'SETTINGS', {
#     'path': get_buffer_file_path,
#     'default_processor': 'XlsxProcessor',
#     'actions': ['mtr.sync.lib.actions'],
#     'converters': ['mtr.sync.lib.converters'],
#     'processors': [
#         'mtr.sync.lib.processors.xlsx',
#         'mtr.sync.lib.processors.xls',
#         'mtr.sync.lib.processors.ods',
#         'mtr.sync.lib.processors.csv',
#     ],
#     'broker': 'rq',
#     'include': {
#         'api': False,
#         'admin': True,
#     }
# })


from django.utils.six.moves import filterfalse
from django.utils.translation import activate
from django.http import QueryDict
from django.contrib.admin.views.main import IGNORED_PARAMS
from mtr.utils.manager import BaseManager
from .helpers import make_model_class, process_attribute, \
    model_fields, cell_value, model_settings
from ..settings import SETTINGS
            'rows': queryset.count(),
            'cols': len(fields),
            'fields': fields,
            'mfields': mfields,
            'items': (
                self.convert_value(
                    process_attribute(item, field.attribute),
                    field, export=True)
                for item in queryset
                for field in fields
            )
        }

    def prepare_handlers(self, key_name, processor, model, context=None):
        prepares = []
        handlers = self.all(key_name) or {}
        for handler in handlers.keys():
            if processor.settings.data_action in handler:
                prepares.append(handlers[handler])

        context = context or {}
        for prepare in prepares:
            context = prepare(model, context)

        return context

    def prepare_context(self, settings, path):
        context = {}
        contexts = settings.contexts.all()


# Path: mtr/sync/lib/helpers.py
# def cell_value(row, cols, processor=None):
# def column_name(index):
# def column_index(value):
# def model_fields(model, settings=None):
# def model_attributes(settings, prefix=None, model=None, parent=None, level=0):
# def make_model_class(settings):
# def _process_fk_attribute(model, attribute):
# def _process_mtm_attribute(model, attribute):
# def process_attribute(model, attribute):
# 
# Path: mtr/sync/settings.py
# SETTINGS = getattr_with_prefix('SYNC', 'SETTINGS', {
#     'path': get_buffer_file_path,
#     'default_processor': 'XlsxProcessor',
#     'actions': ['mtr.sync.lib.actions'],
#     'converters': ['mtr.sync.lib.converters'],
#     'processors': [
#         'mtr.sync.lib.processors.xlsx',
#         'mtr.sync.lib.processors.xls',
#         'mtr.sync.lib.processors.ods',
#         'mtr.sync.lib.processors.csv',
#     ],
#     'broker': 'rq',
#     'include': {
#         'api': False,
#         'admin': True,
#     }
# })


# Path: mtr/sync/lib/manager.py
from django.utils.six.moves import filterfalse
from django.utils.translation import activate
from django.http import QueryDict
from django.contrib.admin.views.main import IGNORED_PARAMS
from mtr.utils.manager import BaseManager
from .helpers import make_model_class, process_attribute, \
    model_fields, cell_value, model_settings
from ..settings import SETTINGS

            'rows': queryset.count(),
            'cols': len(fields),
            'fields': fields,
            'mfields': mfields,
            'items': (
                self.convert_value(
                    process_attribute(item, field.attribute),
                    field, export=True)
                for item in queryset
                for field in fields
            )
        }

    def prepare_handlers(self, key_name, processor, model, context=None):
        prepares = []
        handlers = self.all(key_name) or {}
        for handler in handlers.keys():
            if processor.settings.data_action in handler:
                prepares.append(handlers[handler])

        context = context or {}
        for prepare in prepares:
            context = prepare(model, context)

        return context

    def prepare_context(self, settings, path):
        context = {}
        contexts = settings.contexts.all()


        if not contexts: