views:

19

answers:

1

How can I temporarily turn off verify_exists on a models.URLField at runtime? I would like to skip the check on certain URLs (they block EC2 IPs from their firewall).

I'm interfacing with the model through the ModelForm right now.

A: 
   class F(forms.Form):
    url_field = forms.URLField(verify_exists = True)

form = F({"url_field":"http://blaghblagh.net"})
form.base_fields['url_field'].verify_exists = False
form.is_valid() # returns True
joozek
This didn't work for me. Could it be that this is a ModelForm and verify_exists is set in the Model?
erikcw
Maybe you should try inserting the code into the __init__?
joozek