Deverifying a URLField

9 views
Skip to first unread message

Rich Jones

unread,
Jan 24, 2012, 6:30:18 PM1/24/12
to Django users
Hello, all!

I have a small conundrum I could use a hand with.

I have a deployed Django application with a Model which has a
URLField:

project_homepage = models.URLField('Project Homepage', blank=True)

and a ModelForm to create the parent object.

Currently, the application checks to see if this is a valid URL. I
would like this to be unvalidated instead.

How do I go about changing it? Will I need to do a database migration
to do this? Or can I just add a 'verified=False' and run syncdb?

Thanks so much!
Rich

Mike Dewhirst

unread,
Jan 24, 2012, 7:57:22 PM1/24/12
to django...@googlegroups.com
On 25/01/2012 10:30am, Rich Jones wrote:
> Hello, all!
>
> I have a small conundrum I could use a hand with.
>
> I have a deployed Django application with a Model which has a
> URLField:
>
> project_homepage = models.URLField('Project Homepage', blank=True)

How about ...

project_homepage = models.URLField('Project Homepage', blank=True,
verify_exists=(not settings.DEBUG))

... which should avoid verification during development but make it
happen in production.

bruno desthuilliers

unread,
Jan 25, 2012, 8:52:26 AM1/25/12
to Django users
On Jan 25, 12:30 am, Rich Jones <miser...@gmail.com> wrote:
> Hello, all!

(snip - Mike already answered)

> Will I need to do a database migration
> to do this? Or can I just add a 'verified=False' and run syncdb?

URL Validation is done in django, not in the database, so there's no
need for a migration here. Also note that syncdb DOES NOT migrate
anything - if you have a need for schema and data migrations then
South is your friend.

Reply all
Reply to author
Forward
0 new messages