Author: mtredinnick
Date: 2008-08-23 12:26:00 -0500 (Sat, 23 Aug 2008)
New Revision: 8489

Modified:
   django/trunk/django/forms/fields.py
   django/trunk/django/forms/models.py
Log:
Fixed #7244 -- Allow widget overriding in subclasses for ModelChoiceField,
ModelMultipleChoiceField and FilePathField. Patch from Sebastian Noack and
Colin Grady.


Modified: django/trunk/django/forms/fields.py
===================================================================
--- django/trunk/django/forms/fields.py 2008-08-23 16:56:41 UTC (rev 8488)
+++ django/trunk/django/forms/fields.py 2008-08-23 17:26:00 UTC (rev 8489)
@@ -773,7 +773,7 @@
 
 class FilePathField(ChoiceField):
     def __init__(self, path, match=None, recursive=False, required=True,
-                 widget=Select, label=None, initial=None, help_text=None,
+                 widget=None, label=None, initial=None, help_text=None,
                  *args, **kwargs):
         self.path, self.match, self.recursive = path, match, recursive
         super(FilePathField, self).__init__(choices=(), required=required,

Modified: django/trunk/django/forms/models.py
===================================================================
--- django/trunk/django/forms/models.py 2008-08-23 16:56:41 UTC (rev 8488)
+++ django/trunk/django/forms/models.py 2008-08-23 17:26:00 UTC (rev 8489)
@@ -463,7 +463,7 @@
     }
 
     def __init__(self, queryset, empty_label=u"---------", cache_choices=False,
-                 required=True, widget=Select, label=None, initial=None,
+                 required=True, widget=None, label=None, initial=None,
                  help_text=None, *args, **kwargs):
         self.empty_label = empty_label
         self.cache_choices = cache_choices
@@ -523,6 +523,7 @@
 
 class ModelMultipleChoiceField(ModelChoiceField):
     """A MultipleChoiceField whose choices are a model QuerySet."""
+    widget = SelectMultiple
     hidden_widget = MultipleHiddenInput
     default_error_messages = {
         'list': _(u'Enter a list of values.'),
@@ -531,7 +532,7 @@
     }
 
     def __init__(self, queryset, cache_choices=False, required=True,
-                 widget=SelectMultiple, label=None, initial=None,
+                 widget=None, label=None, initial=None,
                  help_text=None, *args, **kwargs):
         super(ModelMultipleChoiceField, self).__init__(queryset, None,
             cache_choices, required, widget, label, initial, help_text,


--~--~---------~--~----~------------~-------~--~----~
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