=== modified file 'django/contrib/admin/filterspecs.py'
|
|
|
8 | 8 | |
9 | 9 | from django.db import models |
10 | 10 | from django.utils.encoding import smart_unicode, iri_to_uri |
| 11 | from django.utils.text import uncapfirst |
11 | 12 | from django.utils.translation import ugettext as _ |
12 | 13 | import datetime |
13 | 14 | |
… |
… |
|
34 | 35 | raise NotImplementedError() |
35 | 36 | |
36 | 37 | def title(self): |
37 | | return self.field.verbose_name |
| 38 | return uncapfirst(self.field.verbose_name) |
38 | 39 | |
39 | 40 | def output(self, cl): |
40 | 41 | t = [] |
… |
… |
|
64 | 65 | return len(self.lookup_choices) > 1 |
65 | 66 | |
66 | 67 | def title(self): |
67 | | return self.lookup_title |
| 68 | return uncapfirst(self.lookup_title) |
68 | 69 | |
69 | 70 | def choices(self, cl): |
70 | 71 | yield {'selected': self.lookup_val is None, |
… |
… |
|
120 | 121 | ) |
121 | 122 | |
122 | 123 | def title(self): |
123 | | return self.field.verbose_name |
| 124 | return uncapfirst(self.field.verbose_name) |
124 | 125 | |
125 | 126 | def choices(self, cl): |
126 | 127 | for title, param_dict in self.links: |
… |
… |
|
139 | 140 | self.lookup_val2 = request.GET.get(self.lookup_kwarg2, None) |
140 | 141 | |
141 | 142 | def title(self): |
142 | | return self.field.verbose_name |
| 143 | return uncapfirst(self.field.verbose_name) |
143 | 144 | |
144 | 145 | def choices(self, cl): |
145 | 146 | for k, v in ((_('All'), None), (_('Yes'), '1'), (_('No'), '0')): |
… |
… |
|
163 | 164 | self.lookup_choices = model_admin.queryset(request).distinct().order_by(f.name).values(f.name) |
164 | 165 | |
165 | 166 | def title(self): |
166 | | return self.field.verbose_name |
| 167 | return uncapfirst(self.field.verbose_name) |
167 | 168 | |
168 | 169 | def choices(self, cl): |
169 | 170 | yield {'selected': self.lookup_val is None, |
=== modified file 'django/contrib/admin/options.py'
|
|
|
9 | 9 | from django.http import Http404, HttpResponse, HttpResponseRedirect |
10 | 10 | from django.shortcuts import get_object_or_404, render_to_response |
11 | 11 | from django.utils.html import escape |
12 | | from django.utils.text import capfirst, get_text_list |
| 12 | from django.utils.text import capfirst, uncapfirst, get_text_list |
13 | 13 | from django.utils.translation import ugettext as _ |
14 | 14 | from django.utils.encoding import force_unicode |
15 | 15 | import sets |
… |
… |
|
414 | 414 | |
415 | 415 | # default message |
416 | 416 | if add: |
417 | | msg = _('The %(name)s "%(obj)s" was added successfully.') % {'name': opts.verbose_name, 'obj': new_obj} |
| 417 | msg = _('The %(name)s "%(obj)s" was added successfully.') % {'name': uncapfirst(opts.verbose_name), 'obj': new_obj} |
418 | 418 | else: |
419 | | msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': opts.verbose_name, 'obj': new_obj} |
| 419 | msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': uncapfirst(opts.verbose_name), 'obj': new_obj} |
420 | 420 | |
421 | 421 | # save as new |
422 | 422 | if request.POST.has_key('_saveasnew'): |
… |
… |
|
429 | 429 | redirect_url = '../../../' |
430 | 430 | # save and add another |
431 | 431 | elif request.POST.has_key('_addanother'): |
432 | | msg += ' ' + (_('You may add another %s below.') % opts.verbose_name) |
| 432 | msg += ' ' + (_('You may add another %s below.') % uncapfirst(opts.verbose_name)) |
433 | 433 | if add: |
434 | 434 | redirect_url = request.path |
435 | 435 | else: |
… |
… |
|
521 | 521 | inline_admin_formsets.append(inline_admin_formset) |
522 | 522 | |
523 | 523 | c = template.RequestContext(request, { |
524 | | 'title': _('Add %s') % opts.verbose_name, |
| 524 | 'title': _('Add %s') % uncapfirst(opts.verbose_name), |
525 | 525 | 'adminform': adminForm, |
526 | 526 | 'is_popup': request.REQUEST.has_key('_popup'), |
527 | 527 | 'media': media, |
… |
… |
|
547 | 547 | raise PermissionDenied |
548 | 548 | |
549 | 549 | if obj is None: |
550 | | raise Http404('%s object with primary key %r does not exist.' % (opts.verbose_name, escape(object_id))) |
| 550 | raise Http404('%s object with primary key %r does not exist.' % (uncapfirst(opts.verbose_name), escape(object_id))) |
551 | 551 | |
552 | 552 | if request.POST and request.POST.has_key('_saveasnew'): |
553 | 553 | return self.add_view(request) |
… |
… |
|
596 | 596 | inline_admin_formsets.append(inline_admin_formset) |
597 | 597 | |
598 | 598 | c = template.RequestContext(request, { |
599 | | 'title': _('Change %s') % opts.verbose_name, |
| 599 | 'title': _('Change %s') % uncapfirst(opts.verbose_name), |
600 | 600 | 'adminform': adminForm, |
601 | 601 | 'object_id': object_id, |
602 | 602 | 'original': obj, |
… |
… |
|
654 | 654 | raise PermissionDenied |
655 | 655 | |
656 | 656 | if obj is None: |
657 | | raise Http404('%s object with primary key %r does not exist.' % (opts.verbose_name, escape(object_id))) |
| 657 | raise Http404('%s object with primary key %r does not exist.' % (uncapfirst(opts.verbose_name), escape(object_id))) |
658 | 658 | |
659 | 659 | # Populate deleted_objects, a data structure of all related objects that |
660 | 660 | # will also be deleted. |
… |
… |
|
668 | 668 | obj_display = str(obj) |
669 | 669 | obj.delete() |
670 | 670 | LogEntry.objects.log_action(request.user.id, ContentType.objects.get_for_model(self.model).id, object_id, obj_display, DELETION) |
671 | | request.user.message_set.create(message=_('The %(name)s "%(obj)s" was deleted successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': force_unicode(obj_display)}) |
| 671 | request.user.message_set.create(message=_('The %(name)s "%(obj)s" was deleted successfully.') % {'name': force_unicode(uncapfirst(opts.verbose_name)), 'obj': force_unicode(obj_display)}) |
672 | 672 | return HttpResponseRedirect("../../") |
673 | 673 | extra_context = { |
674 | 674 | "title": _("Are you sure?"), |
675 | | "object_name": opts.verbose_name, |
| 675 | "object_name": uncapfirst(opts.verbose_name), |
676 | 676 | "object": obj, |
677 | 677 | "deleted_objects": deleted_objects, |
678 | 678 | "perms_lacking": perms_needed, |
=== modified file 'django/contrib/admin/templates/admin/change_form.html'
|
|
|
18 | 18 | <div class="breadcrumbs"> |
19 | 19 | <a href="../../../">{% trans "Home" %}</a> › |
20 | 20 | <a href="../">{{ opts.verbose_name_plural|capfirst|escape }}</a> › |
21 | | {% if add %}{% trans "Add" %} {{ opts.verbose_name|escape }}{% else %}{{ original|truncatewords:"18"|escape }}{% endif %} |
| 21 | {% if add %}{% trans "Add" %} {{ opts.verbose_name|uncapfirst|escape }}{% else %}{{ original|truncatewords:"18"|escape }}{% endif %} |
22 | 22 | </div> |
23 | 23 | {% endif %}{% endblock %} |
24 | 24 | |
=== modified file 'django/contrib/admin/templates/admin/change_list.html'
|
|
|
15 | 15 | <div id="content-main"> |
16 | 16 | {% block object-tools %} |
17 | 17 | {% if has_add_permission %} |
18 | | <ul class="object-tools"><li><a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %}</a></li></ul> |
| 18 | <ul class="object-tools"><li><a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|uncapfirst|escape as name %}Add {{ name }}{% endblocktrans %}</a></li></ul> |
19 | 19 | {% endif %} |
20 | 20 | {% endblock %} |
21 | 21 | <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist"> |
=== modified file 'django/contrib/admin/templates/admin/edit_inline/stacked.html'
|
|
|
5 | 5 | |
6 | 6 | {% for inline_admin_form in inline_admin_formset %} |
7 | 7 | <div class="inline-related {% if forloop.last %}last-related{% endif %}"> |
8 | | <h2><b>{{ inline_admin_formset.opts.verbose_name|title }}:</b> {% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %} #{{ forloop.counter }}{% endif %} |
| 8 | <h2><b>{{ inline_admin_formset.opts.verbose_name|capfirst }}:</b> {% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %} #{{ forloop.counter }}{% endif %} |
9 | 9 | {% if inline_admin_formset.formset.deletable %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %} |
10 | 10 | </h2> |
11 | 11 | {% if inline_admin_form.show_url %} |
=== modified file 'django/contrib/admin/templates/admin/pagination.html'
|
|
|
7 | 7 | {% endfor %} |
8 | 8 | {% endif %} |
9 | 9 | {% ifequal cl.result_count 1 %} |
10 | | {% blocktrans with cl.result_count as count and cl.opts.verbose_name|escape as verbose_name %}{{ count }} {{ verbose_name }}{% endblocktrans %} |
| 10 | {% blocktrans with cl.result_count as count and cl.opts.verbose_name|uncapfirst|escape as verbose_name %}{{ count }} {{ verbose_name }}{% endblocktrans %} |
11 | 11 | {% else %} |
12 | | {% blocktrans with cl.result_count as count and cl.opts.verbose_name_plural|escape as verbose_name_plural %}{{ count }} {{ verbose_name_plural }}{% endblocktrans %} |
| 12 | {% blocktrans with cl.result_count as count and cl.opts.verbose_name_plural|uncapfirst|escape as verbose_name_plural %}{{ count }} {{ verbose_name_plural }}{% endblocktrans %} |
13 | 13 | {% endifequal %} |
14 | 14 | {% if show_all_url %} <a href="{{ show_all_url }}" class="showall">{% trans 'Show all' %}</a>{% endif %} |
15 | 15 | </p> |
=== modified file 'django/contrib/admin/templatetags/admin_list.py'
|
|
|
5 | 5 | from django.db import models |
6 | 6 | from django.utils import dateformat |
7 | 7 | from django.utils.html import escape |
8 | | from django.utils.text import capfirst |
| 8 | from django.utils.text import capfirst, uncapfirst |
9 | 9 | from django.utils.translation import get_date_formats, get_partial_date_formats, ugettext as _ |
10 | 10 | from django.utils.encoding import smart_unicode, smart_str, force_unicode |
11 | 11 | from django.template import Library |
… |
… |
|
79 | 79 | # attribute "short_description". If that doesn't exist, fall back |
80 | 80 | # to the method name. And __str__ and __unicode__ are special-cases. |
81 | 81 | if field_name == '__unicode__': |
82 | | header = force_unicode(lookup_opts.verbose_name) |
| 82 | header = force_unicode(uncapfirst(lookup_opts.verbose_name)) |
83 | 83 | elif field_name == '__str__': |
84 | | header = smart_str(lookup_opts.verbose_name) |
| 84 | header = smart_str(uncapfirst(lookup_opts.verbose_name)) |
85 | 85 | else: |
86 | 86 | attr = getattr(cl.model, field_name) # Let AttributeErrors propagate. |
87 | 87 | try: |
… |
… |
|
99 | 99 | # after the else clause. |
100 | 100 | else: |
101 | 101 | if isinstance(f.rel, models.ManyToOneRel) and f.null: |
102 | | yield {"text": f.verbose_name} |
| 102 | yield {"text": uncapfirst(f.verbose_name)} |
103 | 103 | continue |
104 | 104 | else: |
105 | | header = f.verbose_name |
| 105 | header = uncapfirst(f.verbose_name) |
| 106 | |
106 | 107 | |
107 | 108 | th_classes = [] |
108 | 109 | new_order_type = 'asc' |
=== modified file 'django/contrib/admin/util.py'
|
|
|
1 | 1 | from django.core.exceptions import ObjectDoesNotExist |
2 | 2 | from django.db import models |
3 | 3 | from django.utils.html import escape |
4 | | from django.utils.text import capfirst |
| 4 | from django.utils.text import capfirst, uncapfirst |
5 | 5 | from django.utils.encoding import force_unicode |
6 | 6 | |
7 | 7 | def _nest_help(obj, depth, val): |
… |
… |
|
83 | 83 | # Don't display link to edit, because it either has no |
84 | 84 | # admin or is edited inline. |
85 | 85 | nh(deleted_objects, current_depth, [_('One or more %(fieldname)s in %(name)s: %(obj)s') % \ |
86 | | {'fieldname': force_unicode(related.field.verbose_name), 'name': force_unicode(related.opts.verbose_name), 'obj': escape(sub_obj)}, []]) |
| 86 | {'fieldname': force_unicode(uncapfirst(related.field.verbose_name)), 'name': force_unicode(uncapfirst(related.opts.verbose_name)), 'obj': escape(sub_obj)}, []]) |
87 | 87 | else: |
88 | 88 | # Display a link to the admin page. |
89 | 89 | nh(deleted_objects, current_depth, [ |
90 | | (_('One or more %(fieldname)s in %(name)s:') % {'fieldname': force_unicode(related.field.verbose_name), 'name': force_unicode(related.opts.verbose_name)}) + \ |
| 90 | (_('One or more %(fieldname)s in %(name)s:') % {'fieldname': force_unicode(uncapfirst(related.field.verbose_name)), 'name': force_unicode(uncapfirst(related.opts.verbose_name))}) + \ |
91 | 91 | (u' <a href="../../../../%s/%s/%s/">%s</a>' % \ |
92 | 92 | (related.opts.app_label, related.opts.module_name, sub_obj._get_pk_val(), escape(sub_obj))), []]) |
93 | 93 | # If there were related objects, and the user doesn't have |
=== modified file 'django/contrib/admin/views/main.py'
|
|
|
9 | 9 | from django.db.models.query import handle_legacy_orderlist, QuerySet |
10 | 10 | from django.http import Http404 |
11 | 11 | from django.utils.encoding import force_unicode, smart_str |
| 12 | from django.utils.text import uncapfirst |
12 | 13 | from django.utils.translation import ugettext |
13 | 14 | import operator |
14 | 15 | |
… |
… |
|
146 | 147 | self.query = request.GET.get(SEARCH_VAR, '') |
147 | 148 | self.query_set = self.get_query_set() |
148 | 149 | self.get_results(request) |
149 | | self.title = (self.is_popup and ugettext('Select %s') % force_unicode(self.opts.verbose_name) or ugettext('Select %s to change') % force_unicode(self.opts.verbose_name)) |
| 150 | self.title = (self.is_popup and ugettext('Select %s') % force_unicode(uncapfirst(self.opts.verbose_name)) or ugettext('Select %s to change') % force_unicode(uncapfirst(self.opts.verbose_name))) |
150 | 151 | self.filter_specs, self.has_filters = self.get_filters(request) |
151 | 152 | self.pk_attname = self.lookup_opts.pk.attname |
152 | 153 | |