# 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
        for prepare in prepares:
            context = prepare(model, context)

        return context

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

        if not contexts:
            return {}

        processor = self.make_processor(settings)
        max_rows, max_cols = processor.open(path)
        processor.set_dimensions(
            0, 0, max_rows, max_cols,
            import_data=True)
        processor._read_from_start = True

        for field in contexts:
            context[field.name] = field.value or cell_value(
                None, field.cell, processor)

        return context

    def prepare_import_data(self, processor, model):
        """Prepare data using filters from settings and return iterator"""

        settings = processor.settings
        fields = list(settings.fields_with_converters())

# 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

        for prepare in prepares:
            context = prepare(model, context)

        return context

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

        if not contexts:
            return {}

        processor = self.make_processor(settings)
        max_rows, max_cols = processor.open(path)
        processor.set_dimensions(
            0, 0, max_rows, max_cols,
            import_data=True)
        processor._read_from_start = True

        for field in contexts:
            context[field.name] = field.value or cell_value(
                None, field.cell, processor)

        return context

    def prepare_import_data(self, processor, model):
        """Prepare data using filters from settings and return iterator"""

        settings = processor.settings
        fields = list(settings.fields_with_converters())

        mfields = model_fields(model) if model else {}