django-autocomplete-light icon indicating copy to clipboard operation
django-autocomplete-light copied to clipboard

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

Open etiennepouliot opened this issue 3 years ago • 2 comments
trafficstars

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

etiennepouliot avatar Apr 22 '22 15:04 etiennepouliot

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

jpic avatar May 01 '22 13:05 jpic

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 ?

etiennepouliot avatar May 02 '22 01:05 etiennepouliot

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

jpic avatar Sep 09 '22 17:09 jpic

Released in 3.9.5-rc1 !

Thank you <3

Will enable by default in next major release

jpic avatar Sep 09 '22 20:09 jpic