Why does this Django code use _
in front of 'has favicon'
has_favicon = models.BooleanField(_('has favicon'))
If you look in the import statements, you'll find that they tied _ to a function that turns stuff into unicode and localizes it by writing:
from django.utils.translation import ugettext_lazy as _
_
in Django is a convention that is used for localizing texts. It is an alias for ugettext_lazy. Read Lazy translation in the docs for more info about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With