def _as_dict(self, check_relationship):
        all_field = {}

        for field in self._meta.fields:
            if field.rel:
                if not check_relationship:
                    continue

            if is_deferred(self, field):
                continue

            field_value = getattr(self, field.attname)

            # If current field value is an expression, we are not evaluating it
            if is_db_expression(field_value):
                continue

            try:
                # Store the converted value for fields with conversion
                field_value = field.to_python(field_value)
            except __HOLE__:
                # The current value is not valid so we cannot convert it
                pass

            if is_buffer(field_value):
                # psycopg2 returns uncopyable type buffer for bytea
                field_value = str(field_value)

            # Explanation of copy usage here :
            # https://github.com/romgar/django-dirtyfields/commit/efd0286db8b874b5d6bd06c9e903b1a0c9cc6b00
            all_field[field.name] = copy(field_value)

        return all_field
dataset/ETHPy150Open romgar/django-dirtyfields/src/dirtyfields/dirtyfields.py/DirtyFieldsMixin._as_dict