Ticket #17122: 2011.10.26_2020_EST.diff
File 2011.10.26_2020_EST.diff, 1.9 KB (added by , 13 years ago) |
---|
-
django/contrib/admin/widgets.py
130 130 131 131 def render(self, name, value, attrs=None): 132 132 rel_to = self.rel.to 133 # custom fields may need the to_python 134 # conversion in order to facilitate 135 # unicode conversion 136 value = rel_to._meta.pk.to_python(value) 133 137 if attrs is None: 134 138 attrs = {} 135 139 extra = [] … … 139 143 (rel_to._meta.app_label, 140 144 rel_to._meta.module_name), 141 145 current_app=self.admin_site.name) 142 146 143 147 params = self.url_parameters() 144 148 if params: 145 149 url = u'?' + u'&'.join([u'%s=%s' % (k, v) for k, v in params.items()]) -
django/forms/forms.py
341 341 hidden_widget = field.hidden_widget() 342 342 initial_value = hidden_widget.value_from_datadict( 343 343 self.data, self.files, initial_prefixed_name) 344 # custom fields may need the to_python 345 # conversion in order to facilitate 346 # unicode conversion 347 if isinstance(initial_value,list): 348 # ManyToManyField uses a list 349 initial_value = [field.to_python(v) for v in initial_value] 350 else: 351 initial_value = field.to_python(initial_value) 344 352 if field.widget._has_changed(initial_value, data_value): 345 353 self._changed_data.append(name) 346 354 return self._changed_data