DJANGOCMS_LINK_INTRANET_HOSTNAME_PATTERN does not work
adrien-delhorme opened this issue · 3 comments
I can't make INTRANET_HOSTNAME_PATTERN
work.
I tried to setup mycustomhostname
as custom pattern but when the validator is executed the regex does not contain mycustomhostname
.
Am I missing something?
@adrien-delhorme would you be able to post us your configuration / setup to debug?
Django==1.8.15
django-cms==3.4.2
djangocms-link==2.1.2
DJANGOCMS_LINK_INTRANET_HOSTNAME_PATTERN = r'whatever'
I tried to submit a form with External link: http://whatever/page/
, but there is an error Enter a valid URL
. Same thing if I keep the default value for HOSTNAME_PATTERN.
It seems that the IntranetURLValidator
is never called but the URLValidator
is (I tried to define a __call__
method inside IntranetURLValidator
).
The problem is:
URLField
has a default_validators
attribute. Initializing the field with validators
attribute does not override but append a validator to the default validators list. So whatever the IntranetURLValidator
does, it is not called because the default URLValidator
fails first.
I made a pull request #130 to fix that.