Code

Ticket #8777: validate-unique-capfirst.diff

File validate-unique-capfirst.diff, 940 bytes (added by Petr Marhoun <petr.marhoun@…>, 6 years ago)
Line 
1=== modified file 'django/forms/models.py'
2--- django/forms/models.py      2008-09-01 19:08:08 +0000
3+++ django/forms/models.py      2008-09-01 22:05:49 +0000
4@@ -5,7 +5,7 @@
5 
6 from django.utils.encoding import smart_unicode
7 from django.utils.datastructures import SortedDict
8-from django.utils.text import get_text_list
9+from django.utils.text import get_text_list, capfirst
10 from django.utils.translation import ugettext_lazy as _
11 
12 from util import ValidationError, ErrorList
13@@ -247,7 +247,7 @@
14             # This cute trick with extra/values is the most efficiant way to
15             # tell if a particular query returns any results.
16             if qs.extra(select={'a': 1}).values('a').order_by():
17-                model_name = self.instance._meta.verbose_name.title()
18+                model_name = capfirst(self.instance._meta.verbose_name)
19                 
20                 # A unique field
21                 if len(unique_check) == 1:
22