Skip to content

has_changed incompatible with model with vector_fields #132

@benwhalley

Description

@benwhalley

I just added a django-pgvector VectorField to my model and am now having an issue with using has_changed.

The error is ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().

The source of the error is /mixins.py", line 91, in _diff_with_initial

This doesn't happen if is_changed=False but if True then every field in the model is checked for changes.

I think there are two issues here:

  1. The check for changes should cope with the case where the field value is a vector/list
  2. The check for changes should only be applied to the fields in when_any, not to all field

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions