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
|
||||
"""
|
||||
import logging
|
||||
import re
|
||||
import zipfile
|
||||
|
||||
from datetime import timedelta, datetime, date
|
||||
|
@ -130,7 +131,9 @@ class EditionForm(forms.ModelForm):
|
|||
)
|
||||
http = forms.RegexField(
|
||||
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,
|
||||
help_text = _("no spaces of funny stuff."),
|
||||
error_messages = {
|
||||
|
|
Loading…
Reference in New Issue