diff options
| author | Claude Paroz <claude@2xlibre.net> | 2015-01-08 15:27:10 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-01-08 15:27:13 +0100 |
| commit | d6c8121ed007e59bac9a68873248104ec30d5d8b (patch) | |
| tree | 4583d2225f9dd340e625b4570bff8e2ab431e13c | |
| parent | de4bfb3fad7caa426fa1f5625df6fbd7579e7cb7 (diff) | |
Removed unneeded smart_text calls
`verbose_name_raw` return value comes from `force_text()` anyway.
| -rw-r--r-- | django/contrib/contenttypes/models.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/django/contrib/contenttypes/models.py b/django/contrib/contenttypes/models.py index 3617389058..fdb4f36de4 100644 --- a/django/contrib/contenttypes/models.py +++ b/django/contrib/contenttypes/models.py @@ -4,7 +4,7 @@ from django.apps import apps from django.db import models from django.db.utils import OperationalError, ProgrammingError from django.utils.translation import ugettext_lazy as _ -from django.utils.encoding import smart_text, force_text +from django.utils.encoding import force_text from django.utils.encoding import python_2_unicode_compatible @@ -63,12 +63,10 @@ class ContentTypeManager(models.Manager): except self.model.DoesNotExist: # Not found in the database; we proceed to create it. This time we # use get_or_create to take care of any race conditions. - # The smart_text() is needed around opts.verbose_name_raw because - # name_raw might be a django.utils.functional.__proxy__ object. ct, created = self.get_or_create( app_label=opts.app_label, model=opts.model_name, - defaults={'name': smart_text(opts.verbose_name_raw)}, + defaults={'name': opts.verbose_name_raw}, ) self._add_to_cache(self.db, ct) return ct @@ -110,7 +108,7 @@ class ContentTypeManager(models.Manager): ct = self.create( app_label=opts.app_label, model=opts.model_name, - name=smart_text(opts.verbose_name_raw), + name=opts.verbose_name_raw, ) self._add_to_cache(self.db, ct) results[ct.model_class()] = ct |
