The fields and model names in the django model are shown as Chinese tip sharing
- 2020-04-02 14:21:57
- OfStack
Easy way:
Models. Py
class IceCreamBar(models.Model):
title =
models.CharField(max_length=200,db_index=True,verbose_name=" The name of the ")
shell = models.CharField(max_length=100,verbose_name=' The skin ')
filling = models.CharField(max_length=100,verbose_name=' contains ')
has_stick = models.BooleanField(default=True,verbose_name=' Is there a stick ')
def __unicode__(self):
return self.title
class Meta:
verbose_name = " Popsicle "
verbose_name_plural = " Popsicle s"
Take advantage of international translation functions:
models
from django.utils.translation import ugettext_lazy as _
class KarmaUser(AbstractUser):
karma = models.PositiveIntegerField(_("karma"),default=0,blank=True)
Then set the translation text inside message.