Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # changing verbose name of model does not change ContentType name
- # this script will loop through all ContentType objects and refresh names
- # optional activate translation
- from django.utils import translation
- translation.activate('en')
- from django.contrib.contenttypes.models import ContentType
- content_types = ContentType.objects.all()
- for ct in content_types:
- model = ct.model_class()
- if model:
- ct.name = model._meta.verbose_name
- ct.save()
Add Comment
Please, Sign In to add comment