Ticket #4829: django-content-type-verbose-name.diff

File django-content-type-verbose-name.diff, 1.2 KB (added by David Danier <goliath.mailinglist@…>, 8 years ago)
  • django/contrib/contenttypes/models.py

    ==== Patch <django-content-type-verbose-name> level 2
    Source: f4626db1-382e-0410-8594-a82d82b39f71:/content-type-verbose-name:5613 [local]
    Target: bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:5643 [mirrored]
            (http://code.djangoproject.com/svn/django)
    Log:
     r5611@damasonium:  ddanier | 2007-07-10 14:37:23 +0200
      * model_verbose_name() and model_verbose_name_plural() as methods of ContentType
    
    === django/contrib/contenttypes/models.py
    ==================================================================
     
    5151        from django.db import models
    5252        return models.get_model(self.app_label, self.model)
    5353
     54    def model_verbose_name(self):
     55        "Returns the verbose name of the model."
     56        return self.model_class()._meta.verbose_name
     57
     58    def model_verbose_name_plural(self):
     59        "Returns the verbose name (plural) of the model."
     60        return self.model_class()._meta.verbose_name_plural
     61
    5462    def get_object_for_this_type(self, **kwargs):
    5563        """
    5664        Returns an object of this type for the keyword arguments given.
Back to Top