changeset 102:50a3c88ad8f5

Text and accent color are now optional.
author Atul Varma <varmaa@toolness.com>
date Fri, 28 Mar 2008 14:14:36 -0700
parents 77fa58115fa4
children 2e86c246d613
files PersonasBackend/personas/models.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/PersonasBackend/personas/models.py	Fri Mar 28 14:05:24 2008 -0700
+++ b/PersonasBackend/personas/models.py	Fri Mar 28 14:14:36 2008 -0700
@@ -99,6 +99,8 @@
 
     Examples:
 
+      >>> ensure_color_is_valid('')
+
       >>> ensure_color_is_valid('blah')
       Traceback (most recent call last):
       ...
@@ -125,6 +127,9 @@
 
     HEX_CHARS = "0123456789abcdef"
 
+    if not color:
+        return
+
     if not color.startswith("#"):
         raise error_class( "The color must start with a '#'." )
     if len(color) > MAX_COLOR_LENGTH:
@@ -229,8 +234,7 @@
                    "on the persona."),
         max_length=MAX_COLOR_LENGTH,
         validator_list=[ensure_color_is_valid],
-        blank=False,
-        default="#000000"
+        blank=True
         )
 
     accent_color = models.CharField(
@@ -239,8 +243,7 @@
                    "on the persona."),
         max_length=MAX_COLOR_LENGTH,
         validator_list=[ensure_color_is_valid],
-        blank=False,
-        default="#000000"
+        blank=True,
         )
 
     date_published = models.DateTimeField(