From e56895d6bf400dcacbdbf66abeef50e81b5d6d71 Mon Sep 17 00:00:00 2001 From: Unai Zalakain Date: Sun, 10 Jun 2012 01:57:04 +0200 Subject: no validation in original URL, that's supposed to be done elsewhere, so URLs like "/without/domain" could be added --- brevisurl/models.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/brevisurl/models.py b/brevisurl/models.py index a9264ab..0a583ad 100644 --- a/brevisurl/models.py +++ b/brevisurl/models.py @@ -13,7 +13,7 @@ log = logging.getLogger(__name__) class ShortUrl(models.Model): """Model that represents shortened url.""" - original_url = models.URLField(null=False, blank=False) + original_url = models.CharField(max_length=200, null=False, blank=False) original_url_hash = models.CharField(max_length=64, null=False, blank=False) shortened_url = models.URLField(max_length=200, null=False, blank=False, unique=True) backend = models.CharField(max_length=200, null=False, blank=False) @@ -32,11 +32,6 @@ class ShortUrl(models.Model): def clean(self): url_validator = URLValidator() - try: - url_validator(self.original_url) - except ValidationError: - log.exception('ShortUrl.original_url is not valid URL') - raise try: url_validator(self.shortened_url) except ValidationError: @@ -55,4 +50,4 @@ class ShortUrl(models.Model): verbose_name = 'Short url' verbose_name_plural = 'Short urls' ordering = ['-created'] - get_latest_by = 'created' \ No newline at end of file + get_latest_by = 'created' -- cgit v1.2.3