Skip to content

Commit

Permalink
Removed unneeded smart_text calls
Browse files Browse the repository at this point in the history
`verbose_name_raw` return value comes from `force_text()` anyway.
  • Loading branch information
claudep committed Jan 8, 2015
1 parent de4bfb3 commit d6c8121
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions django/contrib/contenttypes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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


Expand Down Expand Up @@ -63,12 +63,10 @@ def get_for_model(self, model, for_concrete_model=True):
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
Expand Down Expand Up @@ -110,7 +108,7 @@ def get_for_models(self, *models, **kwargs):
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
Expand Down

0 comments on commit d6c8121

Please sign in to comment.