I want to get docker image URL from the user but URLs can’t be acceptable with models.URLField()
in django.
For example, this URL: hub.something.com/nginx:1.21
, got an error.
How can fix it?
I want to get docker image URL from the user but URLs can’t be acceptable with models.URLField()
in django.
For example, this URL: hub.something.com/nginx:1.21
, got an error.
How can fix it?
2
Answers
Regex reference is here and you can check matchs.
Try this out:
I am not great at regexes but I believe I did it right, when I try new
domain_re
regex, it allows as domain:.com/nginx:1.21
. The rest of url is handled automatically by djangoIf there will be another case of regex, or for some reason this regex won’t work as I expect, I believe from here you will find a way 😉
Just check the URLValidator code and modify accordingly.
PS. Sorry for being late, was out with dog