mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #7244 -- Allow widget overriding in subclasses for ModelChoiceField,
ModelMultipleChoiceField and FilePathField. Patch from Sebastian Noack and Colin Grady. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -773,7 +773,7 @@ class MultiValueField(Field): | |||||||
|  |  | ||||||
| class FilePathField(ChoiceField): | class FilePathField(ChoiceField): | ||||||
|     def __init__(self, path, match=None, recursive=False, required=True, |     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): |                  *args, **kwargs): | ||||||
|         self.path, self.match, self.recursive = path, match, recursive |         self.path, self.match, self.recursive = path, match, recursive | ||||||
|         super(FilePathField, self).__init__(choices=(), required=required, |         super(FilePathField, self).__init__(choices=(), required=required, | ||||||
|   | |||||||
| @@ -463,7 +463,7 @@ class ModelChoiceField(ChoiceField): | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     def __init__(self, queryset, empty_label=u"---------", cache_choices=False, |     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): |                  help_text=None, *args, **kwargs): | ||||||
|         self.empty_label = empty_label |         self.empty_label = empty_label | ||||||
|         self.cache_choices = cache_choices |         self.cache_choices = cache_choices | ||||||
| @@ -523,6 +523,7 @@ class ModelChoiceField(ChoiceField): | |||||||
|  |  | ||||||
| class ModelMultipleChoiceField(ModelChoiceField): | class ModelMultipleChoiceField(ModelChoiceField): | ||||||
|     """A MultipleChoiceField whose choices are a model QuerySet.""" |     """A MultipleChoiceField whose choices are a model QuerySet.""" | ||||||
|  |     widget = SelectMultiple | ||||||
|     hidden_widget = MultipleHiddenInput |     hidden_widget = MultipleHiddenInput | ||||||
|     default_error_messages = { |     default_error_messages = { | ||||||
|         'list': _(u'Enter a list of values.'), |         'list': _(u'Enter a list of values.'), | ||||||
| @@ -531,7 +532,7 @@ class ModelMultipleChoiceField(ModelChoiceField): | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     def __init__(self, queryset, cache_choices=False, required=True, |     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): |                  help_text=None, *args, **kwargs): | ||||||
|         super(ModelMultipleChoiceField, self).__init__(queryset, None, |         super(ModelMultipleChoiceField, self).__init__(queryset, None, | ||||||
|             cache_choices, required, widget, label, initial, help_text, |             cache_choices, required, widget, label, initial, help_text, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user