Ticket #2194: django-unique-together-error.diff

File django-unique-together-error.diff, 890 bytes (added by dackze+django@…, 9 years ago)

Makes validator use only verbose names in this error message

  • django/db/models/manipulators.py

     
    300300        pass
    301301    else:
    302302        raise validators.ValidationError, _("%(object)s with this %(type)s already exists for the given %(field)s.") % \
    303             {'object': capfirst(opts.verbose_name), 'type': field_list[0].verbose_name, 'field': get_text_list(field_name_list[1:], 'and')}
     303            {'object': capfirst(opts.verbose_name),
     304             'type': field_list[0].verbose_name,
     305             'field': get_text_list([f.verbose_name for f in field_list[1:]], 'and')}
    304306
    305307def manipulator_validator_unique_for_date(from_field, date_field, opts, lookup_type, self, field_data, all_data):
    306308    from django.db.models.fields.related import ManyToOneRel
Back to Top