Beispiel #1
0
    def get_modified_fields(self):
        state = object_state(self)
        modified_fields = []
        for attr in state.manager.attributes:
            if not hasattr(attr.impl, 'get_history'):
                continue

        added, unmodified, deleted = attr.impl.get_history(
            state, state.dict)

        if added or deleted:
            field = attr.key
            if field.startswith(anyblok_column_prefix):
                field = field[len(anyblok_column_prefix):]

            modified_fields.append(field)

        return modified_fields
Beispiel #2
0
    def get_modified_fields(self):
        """return the fields which have changed and their previous values"""
        state = object_state(self)
        modified_fields = {}
        for attr in state.manager.attributes:
            if not hasattr(attr.impl, 'get_history'):
                continue

            added, unmodified, deleted = attr.impl.get_history(
                state, state.dict)

            if added or deleted:
                field = attr.key
                if field.startswith(anyblok_column_prefix):
                    field = field[len(anyblok_column_prefix):]

                modified_fields[field] = deleted[0] if deleted else None

        return modified_fields
Beispiel #3
0
    def get_modified_fields(self):
        """return the fields which have changed and their previous values"""
        state = object_state(self)
        modified_fields = {}
        for attr in state.manager.attributes:
            if not hasattr(attr.impl, 'get_history'):
                continue

            added, unmodified, deleted = attr.impl.get_history(
                state, state.dict)

            if added or deleted:
                field = attr.key
                if field.startswith(anyblok_column_prefix):
                    field = field[len(anyblok_column_prefix):]

                modified_fields[field] = deleted[0] if deleted else None

        return modified_fields