mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
committed by
Tim Graham
parent
888c1e9bfe
commit
d1bab24e01
@@ -229,7 +229,7 @@ class CharField(Field):
|
||||
self.validators.append(validators.MaxLengthValidator(int(max_length)))
|
||||
|
||||
def to_python(self, value):
|
||||
"Returns a Unicode object."
|
||||
"Returns a string."
|
||||
if value in self.empty_values:
|
||||
return self.empty_value
|
||||
value = force_text(value)
|
||||
@@ -799,7 +799,7 @@ class ChoiceField(Field):
|
||||
choices = property(_get_choices, _set_choices)
|
||||
|
||||
def to_python(self, value):
|
||||
"Returns a Unicode object."
|
||||
"Return a string."
|
||||
if value in self.empty_values:
|
||||
return ''
|
||||
return force_text(value)
|
||||
|
||||
@@ -200,9 +200,7 @@ class Widget(metaclass=MediaDefiningClass):
|
||||
return context
|
||||
|
||||
def render(self, name, value, attrs=None, renderer=None):
|
||||
"""
|
||||
Returns this Widget rendered as HTML, as a Unicode string.
|
||||
"""
|
||||
"""Render the widget as an HTML string."""
|
||||
context = self.get_context(name, value, attrs)
|
||||
return self._render(self.template_name, context, renderer)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user