As suggested by Eric, we'll use a regex from https://mathiasbynens.be/demo/url-regex,
specifically the one by @imme_emosolpull/1/head
parent
842c0e07e1
commit
08e1806db2
|
@ -2,6 +2,7 @@
|
||||||
external library imports
|
external library imports
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
from datetime import timedelta, datetime, date
|
from datetime import timedelta, datetime, date
|
||||||
|
@ -130,7 +131,9 @@ class EditionForm(forms.ModelForm):
|
||||||
)
|
)
|
||||||
http = forms.RegexField(
|
http = forms.RegexField(
|
||||||
label=_("HTTP URL"),
|
label=_("HTTP URL"),
|
||||||
regex=r'^(https?\://[a-zA-Z0-9\-_\%\~\$\?\(\)\&\!\;\:\.\,\+\=]*|delete)$',
|
# https://mathiasbynens.be/demo/url-regex
|
||||||
|
regex=re.compile(r"(https?|ftp)://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$",
|
||||||
|
flags=re.IGNORECASE|re.S ),
|
||||||
required = False,
|
required = False,
|
||||||
help_text = _("no spaces of funny stuff."),
|
help_text = _("no spaces of funny stuff."),
|
||||||
error_messages = {
|
error_messages = {
|
||||||
|
|
Loading…
Reference in New Issue