This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept about: and chrome:// URL submissions as well as http/https. Bu…
…g 600094.
- Loading branch information
Fred Wenzel
committed
Nov 2, 2010
1 parent
03e610a
commit 7ff5c90
Showing
4 changed files
with
112 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.db.models.fields import URLField, CharField | ||
from django.core.validators import URLValidator | ||
|
||
from .validators import ExtendedURLValidator | ||
|
||
|
||
class ExtendedURLField(URLField): | ||
"""(Model) URLField that allows about: and chrome: URLs.""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(ExtendedURLField, self).__init__(*args, **kwargs) | ||
|
||
# Remove old URL validator, add ours instead. | ||
self.validators = filter(lambda x: not isinstance(x, URLValidator), | ||
self.validators) | ||
self.validators.append(ExtendedURLValidator(verify_exists=verify_exists)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters