yourlabs / django-autocomplete-light

A fresh approach to autocomplete implementations, specially for Django. Status: v4 alpha, v3 stable, v2 & v1 deprecated.
https://django-autocomplete-light.readthedocs.io
MIT License
1.79k stars 467 forks source link

Add the option to validate the field when creating a new choice #1293

Closed etiennepouliot closed 1 year ago

etiennepouliot commented 2 years ago

Add the option of validating the data when creating a new option.

Result in the example if we try to create a new option with the added validate_slug

@python_2_unicode_compatible
class TModel(models.Model):
    name = models.CharField(
        max_length=200,
        validators = [validate_slug]
    )

image

jpic commented 2 years ago

Superb! But are you sure we don't want to have validate_create enabled by default?

etiennepouliot commented 2 years ago

I didn't feel like I was the one to make that decision as this isn't my projet ;)

If you want it enabled by default I could change my PR to have an option to disable it or no option at all and enabled all the time.

what to you think ?

jpic commented 1 year ago

I think enable it by default, we want secure by default, we'll do a medium version number bump and a CHANGELOG entry

jpic commented 1 year ago

Released in 3.9.5-rc1 !

Thank you <3

Will enable by default in next major release