Commit f9dad46d authored by Carl Meyer's avatar Carl Meyer
Browse files

Fixed #16803 -- Use model verbose_name directly as ContentType unicode...

Fixed #16803 -- Use model verbose_name directly as ContentType unicode representation so it can be translated. Thanks to bronger for the report and Ivan Sagalaev for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16839 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 568681c6
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django.utils.encoding import smart_unicode, force_unicode

class ContentTypeManager(models.Manager):

@@ -85,7 +85,18 @@ class ContentType(models.Model):
        unique_together = (('app_label', 'model'),)

    def __unicode__(self):
        # self.name is deprecated in favor of using model's verbose_name, which
        # can be translated. Formal deprecation is delayed until we have DB
        # migration to be able to remove the field from the database along with
        # the attribute.
        #
        # We return self.name only when users have changed its value from the
        # initial verbose_name_raw and might rely on it.
        meta = self.model_class()._meta
        if self.name != meta.verbose_name_raw:
            return self.name
        else:
            return force_unicode(meta.verbose_name)

    def model_class(self):
        "Returns the Python model class for this type of content."
+0 −0

Empty file added.

+418 B

File added.

No diff preview for this file type.

+26 −0
Original line number Diff line number Diff line
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-09-15 15:41-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: models.py:6
msgid "Anything"
msgstr ""

#: models.py:15
msgid "Company"
msgstr "Company"
 No newline at end of file
+461 B

File added.

No diff preview for this file type.

Loading