Author: gwilson
Date: 2007-11-18 22:07:03 -0600 (Sun, 18 Nov 2007)
New Revision: 6699

Modified:
   django/trunk/django/newforms/models.py
Log:
Made use of `EMPTY_VALUES` in `ModelChoiceField.clean()`.


Modified: django/trunk/django/newforms/models.py
===================================================================
--- django/trunk/django/newforms/models.py      2007-11-19 04:00:41 UTC (rev 
6698)
+++ django/trunk/django/newforms/models.py      2007-11-19 04:07:03 UTC (rev 
6699)
@@ -9,7 +9,7 @@
 
 from util import ValidationError
 from forms import BaseForm
-from fields import Field, ChoiceField
+from fields import Field, ChoiceField, EMPTY_VALUES
 from widgets import Select, SelectMultiple, MultipleHiddenInput
 
 __all__ = (
@@ -200,7 +200,7 @@
 
     def clean(self, value):
         Field.clean(self, value)
-        if value in ('', None):
+        if value in EMPTY_VALUES:
             return None
         try:
             value = self.queryset.get(pk=value)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to