From f15a983d88328f87b35390b827e3a747c6bf181b Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Mon, 27 Feb 2006 23:45:17 +0000 Subject: [PATCH] Fixed #1336 -- made USStateField work correctly when data is None (thanks, chrisb) git-svn-id: http://code.djangoproject.com/svn/django/trunk@2427 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/formfields.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/django/core/formfields.py b/django/core/formfields.py index 3289be5235..167439cc07 100644 --- a/django/core/formfields.py +++ b/django/core/formfields.py @@ -875,7 +875,10 @@ class USStateField(TextField): raise validators.CriticalValidationError, e.messages def html2python(data): - return data.upper() # Should always be stored in upper case + if data: + return data.upper() # Should always be stored in upper case + else: + return None html2python = staticmethod(html2python) class CommaSeparatedIntegerField(TextField):