# Path: mtr/sync/lib/manager.py
# class Manager(BaseManager):
#     def convert_value(self, value, field, export=False, action=None):
#     def processor_choices(self):
#     def dataset_choices(self):
#     def action_choices(self):
#     def converter_choices(self):
#     def make_processor(self, settings, from_extension=False):
#     def export_data(self, settings, data=None):
#     def export_data_inline(self, **settings):
#     def import_data_inline(self, **settings):
#     def filter_dataset(self, settings, dataset=None):
#     def prepare_export_dataset(self, settings):
#     def prepare_export_data(self, processor, queryset):
#     def prepare_handlers(self, key_name, processor, model, context=None):
#     def prepare_context(self, settings, path):
#     def prepare_import_data(self, processor, model):
#     def import_data(self, settings, path=None):
#     def prepare_import_dataset(self, settings, processor, model, fields):
#     def model_data(self, settings, processor, model, fields):
# 
# Path: mtr/sync/translation.py



from django.db import models
from .manager import manager
from ..translation import gettext_lazy as _
from mtr.utils.helpers import update_instance
        save_instance = True
    elif update:
        updated_attrs = filter_attrs(
            kwargs['raw_attrs'], kwargs['fields'], kwargs['mfields'])
        instance = update_instance(instance, updated_attrs)

    for key in related_attrs.keys():
        related_field = kwargs['mfields'].get(key)
        related_model = related_field.rel.to

        if isinstance(related_field, models.ForeignKey):
            create_related_instance(
                instance, fk_filters, related_model,
                related_attrs, key, fk_updated_attrs)

        elif isinstance(related_field, models.ManyToManyField):
            create_mtm_instance(
                add_after,
                instance, m_filters, related_model,
                related_attrs, key, m_updated_attrs)

    if save_instance:
        instance.save()

    for key, instances in add_after.items():
        getattr(instance, key).add(*instances)

    return context



# Path: mtr/sync/lib/manager.py
# class Manager(BaseManager):
#     def convert_value(self, value, field, export=False, action=None):
#     def processor_choices(self):
#     def dataset_choices(self):
#     def action_choices(self):
#     def converter_choices(self):
#     def make_processor(self, settings, from_extension=False):
#     def export_data(self, settings, data=None):
#     def export_data_inline(self, **settings):
#     def import_data_inline(self, **settings):
#     def filter_dataset(self, settings, dataset=None):
#     def prepare_export_dataset(self, settings):
#     def prepare_export_data(self, processor, queryset):
#     def prepare_handlers(self, key_name, processor, model, context=None):
#     def prepare_context(self, settings, path):
#     def prepare_import_data(self, processor, model):
#     def import_data(self, settings, path=None):
#     def prepare_import_dataset(self, settings, processor, model, fields):
#     def model_data(self, settings, processor, model, fields):
# 
# Path: mtr/sync/translation.py



# Path: mtr/sync/lib/actions.py
from django.db import models
from .manager import manager
from ..translation import gettext_lazy as _
from mtr.utils.helpers import update_instance

        save_instance = True
    elif update:
        updated_attrs = filter_attrs(
            kwargs['raw_attrs'], kwargs['fields'], kwargs['mfields'])
        instance = update_instance(instance, updated_attrs)

    for key in related_attrs.keys():
        related_field = kwargs['mfields'].get(key)
        related_model = related_field.rel.to

        if isinstance(related_field, models.ForeignKey):
            create_related_instance(
                instance, fk_filters, related_model,
                related_attrs, key, fk_updated_attrs)

        elif isinstance(related_field, models.ManyToManyField):
            create_mtm_instance(
                add_after,
                instance, m_filters, related_model,
                related_attrs, key, m_updated_attrs)

    if save_instance:
        instance.save()

    for key, instances in add_after.items():
        getattr(instance, key).add(*instances)

    return context



@manager.register('action', _('Create or update'), use_transaction=True)