Changing verbose_name on model field in django admin
I have this sample model working with admin
class Author(models.Model):
name = models.CharField(_('Text in here'), max_length=100)
with verbose_name set to ugettext_lazy "Text here" but sometimes, depending on site_id, I want to present a different verbose name, so I changed init this way
def __init__(self, *args, **kwargs):
super(Author, self).__init__(*args, **kwargs)
#some logic in here
self._meta.get_field('name').verbose_name = _('Other text')
It works by showing "Other text" instead of "Text here" ... except that the author / append is used the first time.
Is it correct? ¿How can I fix the problem the first time?
Thanks in advance
+2
a source to share