pgvector / pgvector-python

pgvector support for Python
MIT License
951 stars 63 forks source link

Fix for blank django form fields when VectorField is not required #68

Closed Cdingram closed 5 months ago

Cdingram commented 5 months ago

If you have a non-required VectorField in django (null=True/blank=True), the saving or creation of a model with a django form would error when trying to save it as blank. This was due to the inherited functionality from forms.CharField. If you look at how JSONFields (which also inherit CharField) they do the same thing as this fix for empty_values. You can try my test case before/after the change in forms.py.

Cdingram commented 5 months ago

Thanks, let me know if this looks better.

ankane commented 5 months ago

Thanks @Cdingram, looks good without the last commit.

Cdingram commented 5 months ago

Yeah sorry github made me think there was no space. Reverted it.

ankane commented 5 months ago

Looks great, thanks!