From 50885d72e381a991e48fd0746006ad37436a8b37 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 3 Aug 2023 20:14:50 +0700 Subject: [PATCH] 13319 add verbose name to model --- docs/development/internationalization.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/development/internationalization.md b/docs/development/internationalization.md index 276fa9747..2cf2ef76d 100644 --- a/docs/development/internationalization.md +++ b/docs/development/internationalization.md @@ -13,8 +13,9 @@ NetBox follows the [Django translation guide](https://docs.djangoproject.com/en/ ## Models 1. Import gettext_lazy. -2. Make sure all model fields have a verbose_name defined. -3. Wrap all verbose_name and help_text fields with the gettext_lazy shortcut. +2. Define both verbose_name and verbose_name_plural in the model Meta and wrap them strings with the gettext_lazy shortcut. +3. Make sure all model fields have a verbose_name defined. +4. Wrap all verbose_name and help_text fields with the gettext_lazy shortcut. ``` from django.utils.translation import gettext_lazy as _ @@ -26,6 +27,9 @@ class Circuit(PrimaryModel): help_text=_("Committed rate") ) + class Meta: + verbose_name = _('circuit') + verbose_name_plural = _('circuits') ``` **Note:** The Django docs specifically state for internationalization: "It is recommended to always provide explicit verbose_name and verbose_name_plural options"