Fixed #2194 -- Tweaked error message for unique_together validator to display

all verbose field names. Patch from dackze+django@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3854 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2006-09-26 10:19:40 +00:00
parent e149c8bb87
commit 5371ee1743
2 changed files with 2 additions and 1 deletions

View File

@ -64,6 +64,7 @@ answer newbie questions, and generally made Django that much better:
Ian Clelland <clelland@gmail.com> Ian Clelland <clelland@gmail.com>
crankycoder@gmail.com crankycoder@gmail.com
Matt Croydon <http://www.postneo.com/> Matt Croydon <http://www.postneo.com/>
dackze+django@gmail.com
Jonathan Daugherty (cygnus) <http://www.cprogrammer.org/> Jonathan Daugherty (cygnus) <http://www.cprogrammer.org/>
Jason Davies (Esaj) <http://www.jasondavies.com/> Jason Davies (Esaj) <http://www.jasondavies.com/>
Alex Dedul Alex Dedul

View File

@ -300,7 +300,7 @@ def manipulator_validator_unique_together(field_name_list, opts, self, field_dat
pass pass
else: else:
raise validators.ValidationError, _("%(object)s with this %(type)s already exists for the given %(field)s.") % \ raise validators.ValidationError, _("%(object)s with this %(type)s already exists for the given %(field)s.") % \
{'object': capfirst(opts.verbose_name), 'type': field_list[0].verbose_name, 'field': get_text_list(field_name_list[1:], 'and')} {'object': capfirst(opts.verbose_name), 'type': field_list[0].verbose_name, 'field': get_text_list([f.verbose_name for f in field_list[1:]], 'and')}
def manipulator_validator_unique_for_date(from_field, date_field, opts, lookup_type, self, field_data, all_data): def manipulator_validator_unique_for_date(from_field, date_field, opts, lookup_type, self, field_data, all_data):
from django.db.models.fields.related import ManyToOneRel from django.db.models.fields.related import ManyToOneRel