def __new__(mcs, name, bases, attrs, **kwargs):
    cls = super().__new__(mcs, name, bases, attrs)
    if (kwargs.get('skip', False) or (object_storage.key_for_class(attrs['__module__'], name) == mcs.base_class)):
        return cls
    object_stub = ClassStub(name=cls.__name__, bases=(Object,))
    object_stub.add_attr('__module__', cls.__module__)
    assert (cls.model is not None), '`model` must be set.'
    if cls.class_for_related:
        model_django_object_storage.store(cls.model, cls)
    (cls.pk_field_name, cls.pk_field) = get_pk_field(cls.model)
    object_stub.add_attr('pk_field', cls.pk_field_name)
    if (cls.only_fields and (cls.pk_field_name not in cls.only_fields)):
        cls.only_fields = (cls.only_fields + (cls.pk_field_name,))
    elif (cls.exclude_fields and (cls.pk_field_name in cls.exclude_fields)):
        cls.exclude_fields = (f for f in cls.exclude_fields if (f != cls.pk_field_name))
    (fields, input_fields, output_fields, field_validators) = determine_simple_api_fields(cls.model, cls.only_fields, cls.exclude_fields, cls.custom_fields, cls.input_custom_fields, cls.output_custom_fields)
    for f in input_fields:
        assert (f not in fields), 'Redefinition of `{}` field.'.format(f)
    cls.in_fields = {**fields, **input_fields}
    for f in output_fields:
        assert (f not in fields), 'Redefinition of `{}` field.'.format(f)
    cls.out_fields = {**fields, **output_fields}
    object_stub.add_attr('fields', fields)
    object_stub.add_attr('input_fields', input_fields)
    object_stub.add_attr('output_fields', output_fields)
    cls.filter_type = ObjectMeta('{}Filters'.format(cls.__name__), (Object,), {'fields': generate_filters(cls)})
    object_stub.add_attr('filter_type', cls.filter_type)
    create_associated_list_type(cls)
    actions = {}
    if (cls.detail_action is not None):
        actions['detail'] = deepcopy(cls.detail_action)
    if (cls.list_action is not None):
        actions['list'] = deepcopy(cls.list_action)
    if (cls.create_action is not None):
        actions['create'] = deepcopy(cls.create_action)
    if (cls.update_action is not None):
        actions['update'] = deepcopy(cls.update_action)
    if (cls.delete_action is not None):
        actions['delete'] = deepcopy(cls.delete_action)
    actions.update(cls.custom_actions)
    converted_actions = {}
    for (action_name, action) in actions.items():
        action.set_parent_class(cls)
        action.set_name(action_name)
        converted_actions[action_name] = action.to_action()
    object_stub.add_attr('actions', converted_actions)
    if (cls.field_difficulty_scores is not None):
        object_stub.add_attr('field_difficulty_scores', cls.field_difficulty_scores)
    cls._object = object_stub.build(ObjectMeta)
    return cls
def __new__(mcs, name, bases, attrs, **kwargs):
    cls = super().__new__(mcs, name, bases, attrs)
    if (kwargs.get('skip', False) or (object_storage.key_for_class(attrs['__module__'], name) == mcs.base_class)):
        return cls
    object_stub = ClassStub(name=cls.__name__, bases=(Object,))
    object_stub.add_attr('__module__', cls.__module__)
    assert (cls.model is not None), '`model` must be set.'
    if cls.class_for_related:
        model_django_object_storage.store(cls.model, cls)
    (cls.pk_field_name, cls.pk_field) = get_pk_field(cls.model)
    object_stub.add_attr('pk_field', cls.pk_field_name)
    if (cls.only_fields and (cls.pk_field_name not in cls.only_fields)):
        cls.only_fields = (cls.only_fields + (cls.pk_field_name,))
    elif (cls.exclude_fields and (cls.pk_field_name in cls.exclude_fields)):
        cls.exclude_fields = (f for f in cls.exclude_fields if (f != cls.pk_field_name))
    (fields, input_fields, output_fields, field_validators) = determine_simple_api_fields(cls.model, cls.only_fields, cls.exclude_fields, cls.custom_fields, cls.input_custom_fields, cls.output_custom_fields)
    for f in input_fields:
        assert (f not in fields), 'Redefinition of `{}` field.'.format(f)
    cls.in_fields = {**fields, **input_fields}
    for f in output_fields:
        assert (f not in fields), 'Redefinition of `{}` field.'.format(f)
    cls.out_fields = {**fields, **output_fields}
    object_stub.add_attr('fields', fields)
    object_stub.add_attr('input_fields', input_fields)
    object_stub.add_attr('output_fields', output_fields)
    cls.filter_type = ObjectMeta('{}Filters'.format(cls.__name__), (Object,), {'fields': generate_filters(cls)})
    object_stub.add_attr('filter_type', cls.filter_type)
    create_associated_list_type(cls)
    actions = {}
    if (cls.detail_action is not None):
        actions['detail'] = deepcopy(cls.detail_action)
    if (cls.list_action is not None):
        actions['list'] = deepcopy(cls.list_action)
    if (cls.create_action is not None):
        actions['create'] = deepcopy(cls.create_action)
    if (cls.update_action is not None):
        actions['update'] = deepcopy(cls.update_action)
    if (cls.delete_action is not None):
        actions['delete'] = deepcopy(cls.delete_action)
    actions.update(cls.custom_actions)
    converted_actions = {}
    for (action_name, action) in actions.items():
        action.set_parent_class(cls)
        action.set_name(action_name)
        converted_actions[action_name] = action.to_action()
    object_stub.add_attr('actions', converted_actions)
    if (cls.field_difficulty_scores is not None):
        object_stub.add_attr('field_difficulty_scores', cls.field_difficulty_scores)
    cls._object = object_stub.build(ObjectMeta)
    return cls