I have 3 url fields defined in my model as follows:
image_1 = models.URLField(max_length=100, verify_exists=True, blank=True)
image_2 = models.URLField(max_length=100, verify_exists=True, blank=True)
image_3 = models.URLField(max_length=100, verify_exists=True, blank=True)
My question is, is there a way I can test whether the verify_exists returns True or False and if so take action depending on the output?
What django does is it use’s the
URLValidatorto see if the url is valid or not.what you could is use the same validations which is present in
django.coreEDIT:
For example lets say you have to validate if django official website with url https://www.djangoproject.com/, exists or not. the code would simply look like this: