# 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

            if '' not in orders and '' not in fields:
                ordering = []
                for order in orders:
                    field = fields[abs(int(order))]
                    if int(order) < 0:
                        field = '-{}'.format(field)
                    ordering.append(field)
                dataset = dataset.order_by(*ordering)

        return dataset

    def prepare_export_dataset(self, settings):
        current_model = make_model_class(settings)

        if settings.dataset:
            dataset = self.get('dataset', settings.dataset)
            dataset = dataset(current_model, settings)
        else:
            dataset = current_model._default_manager.all()

        dataset = self.filter_dataset(settings, dataset)

        return dataset

    def prepare_export_data(self, processor, queryset):
        """Prepare data using filters from settings
        and return data with dimensions"""

        settings = processor.settings

# 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


            if '' not in orders and '' not in fields:
                ordering = []
                for order in orders:
                    field = fields[abs(int(order))]
                    if int(order) < 0:
                        field = '-{}'.format(field)
                    ordering.append(field)
                dataset = dataset.order_by(*ordering)

        return dataset

    def prepare_export_dataset(self, settings):
        current_model = make_model_class(settings)

        if settings.dataset:
            dataset = self.get('dataset', settings.dataset)
            dataset = dataset(current_model, settings)
        else:
            dataset = current_model._default_manager.all()

        dataset = self.filter_dataset(settings, dataset)

        return dataset

    def prepare_export_data(self, processor, queryset):
        """Prepare data using filters from settings
        and return data with dimensions"""

        settings = processor.settings

        model = make_model_class(settings)