Update model field definitions to use gettext_lazy #8311

Closed
opened 2025-12-29 20:35:13 +01:00 by adam · 0 comments
Owner

Originally created by @arthanson on GitHub (Jul 10, 2023).

Originally assigned to: @arthanson on GitHub.

Proposed Changes

In order to correctly support internationalization, models need to be audited and add in the name as gettext_lazy string and update verbose_name where applicable to use gettext_lazy. See Django's use at https://github.com/django/django/blob/main/django/contrib/auth/models.py#L356

    slug = models.SlugField(
        _("slug"), <- add this
        max_length=100
    )

Justification

Model fields need their name (and where appropriate their verbose_name) as translatable strings.

Originally created by @arthanson on GitHub (Jul 10, 2023). Originally assigned to: @arthanson on GitHub. ### Proposed Changes In order to correctly support internationalization, models need to be audited and add in the name as gettext_lazy string and update verbose_name where applicable to use gettext_lazy. See Django's use at https://github.com/django/django/blob/main/django/contrib/auth/models.py#L356 ``` slug = models.SlugField( _("slug"), <- add this max_length=100 ) ``` ### Justification Model fields need their name (and where appropriate their verbose_name) as translatable strings.
adam added the type: housekeepingtopic: Internationalization labels 2025-12-29 20:35:13 +01:00
adam closed this issue 2025-12-29 20:35:13 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8311