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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:32:14+00:00 2026-06-03T13:32:14+00:00

I created a django project. It contains a model class with a type attribute

  • 0

I created a django project. It contains a model class with a “type” attribute. I think that “type” is the most appropriate term to describe that field, because it defines the kind of the entry.

class Vehicle(models.Model):
    TYPE = (
        (u'car', u'Car'),
        (u'motorcycle', u'Motorcycle'),
        (u'airplane', u'Airplane'),
    )

    type = models.CharField(max_length=100, choices=TYPE)

I do not like “kind” or “category” that much because they are not as generic as “type”.

The problem

Assignment to reserved built-in symbol: type
  1. This is a warning, so is that a problem?
  2. If yes, what choices do i have?
  3. Do you have a good alternative to the term “type”?
  • 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-06-03T13:32:16+00:00Added an answer on June 3, 2026 at 1:32 pm
    1. It’s always a bad idea to have a variable name that shadows one of
      python’s built-ins. It will confuse people reading your code, who expect type to mean something specific. Less important than readability to other users it can also throw off syntax highlighting.
    2. Rename the variable. (really it’s the best thing to do – you could leave it, but rename now while it’s easy)
    3. There are lots of potential options, perhaps classification or category. I know you said you don’t like category, but I can’t see what’s not generic about it?

    It might be that it would be overkill for your specific application (would need to know more), but django does support model inheritance.

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

Sidebar

Related Questions

I'm really new to Python and Django. I created a class in Python that
I have a Django project that contains two applications App1 and App2 I have
So I have a django project I just created called 'coolprojectsite' the directory structure
it's fairly easy to set up Eclipse to run a django project's tests created
I would like to deplay a django application/project, which i have created within Aptana.
I created a textmate project for a django app I'm working on, and I
I create a new Django app (not project) called Bussinesses, then add following class
I have a Category model, and a Project model, which contains a ForeignKey to
Just installed Django (with easy_install) and created a project, but can't get mysql to
I created a sub-directory of my Django project called bin where I want to

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.