Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4320934
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:41:17+00:00 2026-05-21T08:41:17+00:00

I have a Model and ModelForm like: from django.utils.translation import ugettext_lazy as _ class

  • 0

I have a Model and ModelForm like:

from django.utils.translation import ugettext_lazy as _

class Item(models.Model):

    category = models.CharField(
        max_length=256,
        choices=(
            ('car', _("Cars")),
            ('computers', _("Computers")),
            ('furry animal', _("Furry or large animals")),
            ))


class ItemForm(ModelForm):
    class Meta:
        model = Item

I have properly catalogued, translated and compiled the strings, and {% trans "Cars" %} shows the translated text as expected.

Now if I pass instances of ItemForm and Item to a template, and use them as {{ form }} and {{ item.category }}, am I correct to assume that they will not by default show the localized choices?

What would be the cleanest and simplest way of having them localized?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T08:41:17+00:00Added an answer on May 21, 2026 at 8:41 am

    Have you tried this yourself?

    I’m pretty sure they would be localized. At least {{ form }}, whereas you would want to use {{ item.get_category_display }} to get the display value for the category field (i.e. “Furry or large animals”/”Pelzige oder grosse Tiere” (localized) rather than “furry animal” (internal string)).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given: from django.db import models class MyModel(models.Model): ... owners = models.CharField(max_length=255, blank=False) where owners
I have a django model and model form that look like this: -models.py class
So I have a few Django models that look like this: class City(models.Model): name
I have a class Book : from django.db import models from users.models import User
I have the following models: class Product(models.Model): active = models.BooleanField(default=True) name = models.CharField(max_length=40, unique=True)
I have the following model and it's form: class Project(models.Model) class ProjectForm(forms.ModelForm) class Meta:
I have 2 models: class Person( models.Model ): username = models.CharField name = models.CharField(
I have a model that looks like this class RSVP (models.Model): def __unicode__(self): return
Is it possible to have multiple models included in a single ModelForm in django?
I am a bit puzzled with the Django object models. I have models like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.