Ticket #4471: remove_stars_from_errors.diff
File remove_stars_from_errors.diff, 1.8 KB (added by , 17 years ago) |
---|
-
django/newforms/util.py
24 24 return u'<ul class="errorlist">%s</ul>' % ''.join([u'<li>%s%s</li>' % (k, v) for k, v in self.items()]) 25 25 26 26 def as_text(self): 27 return u'\n'.join([u' * %s\n%s' % (k, u'\n'.join([u' *%s' % i for i in v])) for k, v in self.items()])27 return u'\n'.join([u' %s\n%s' % (k, u'\n'.join([u' %s' % i for i in v])) for k, v in self.items()]) 28 28 29 29 class ErrorList(list): 30 30 """ … … 39 39 40 40 def as_text(self): 41 41 if not self: return u'' 42 return u'\n'.join([u' *%s' % e for e in self])42 return u'\n'.join([u' %s' % e for e in self]) 43 43 44 44 class ValidationError(Exception): 45 45 def __init__(self, message): -
tests/regressiontests/forms/tests.py
2013 2013 >>> p.errors.as_ul() 2014 2014 u'<ul class="errorlist"><li>first_name<ul class="errorlist"><li>This field is required.</li></ul></li><li>birthday<ul class="errorlist"><li>This field is required.</li></ul></li></ul>' 2015 2015 >>> print p.errors.as_text() 2016 *first_name2017 *This field is required.2018 *birthday2019 *This field is required.2016 first_name 2017 This field is required. 2018 birthday 2019 This field is required. 2020 2020 >>> p.cleaned_data 2021 2021 Traceback (most recent call last): 2022 2022 ... … … 2026 2026 >>> p['first_name'].errors.as_ul() 2027 2027 u'<ul class="errorlist"><li>This field is required.</li></ul>' 2028 2028 >>> p['first_name'].errors.as_text() 2029 u' *This field is required.'2029 u' This field is required.' 2030 2030 2031 2031 >>> p = Person() 2032 2032 >>> print p['first_name']