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 3315528
In Process

The Archive Base Latest Questions

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

I understand that in Django, the ORM doesn’t support the ENUM type in MySQL

  • 0

I understand that in Django, the ORM doesn’t support the ENUM type in MySQL or PostgreSQL, as this was originally a MySQL extension, and not portable across other DB types. So the two options are to use a “choices” argument to your model, or using a foreign key reference.

What are the pros and cons of these approaches?

For something like gender, I assume you would use “choices”, e.g.:

GENDER_CHOICES = (
    ('M', 'Male'),
    ('F', 'Female'),
)
...
gender = models.CharField(max_length=1, choices=GENDER_CHOICES)

However, for something like state names, what are the reason for and against using a separate table, and foreign keys to that table?

state = models.ForeignKey(AustralianState)

Under what circumstances would you use one versus the other?

Cheers,
Victor

  • 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-17T22:21:40+00:00Added an answer on May 17, 2026 at 10:21 pm

    You should also consider foreign keys when the number of potential choices is large. That’s one of the reasons to consider using FK for countries or states. Otherwise, you’re effectively hard-coding a lot of data in your source code.

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

Sidebar

Related Questions

I have a problem with django's MVC. I understand that this is not the
I was reading about Django's support for custom user profiles. I understand that if
I understand how to create a virtualenv, activate that virtualenv, and then install django
I understand that this question may be subjective, this is why I need an
I understand that, by default, Django auto-populates id for each form field upon rendering
Django community seems to encourage the use of Postgres, I understand that in a
I understand that in a built-in Django filter called date . I want to
I understand that there are many existing questions about Django template images, but I
I understand that there are big differences in data-store, but surely since django is
I am writing a mobile application for a django website. i understand that every

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.