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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:41:36+00:00 2026-05-27T00:41:36+00:00

NOTE : this was asked before AbstractUser existed, which is probably what you’d want

  • 0

NOTE: this was asked before AbstractUser existed, which is probably what you’d want to use these days.

Basically I would like to delete the default email field from the default Django User class…

class MyUser(User):
    field = models.CharField(max_length = 10)
    a = 'hello'
    def b(self):
        print 'world'

del User.email
del MyUser.email
del Myuser.field

All these give AttributeError. Deleting methods or attributes in the following way though works fine:

del MyUser.a
del MyUser.b

So I’m curious why this doesn’t work; what type of things are these model fields?

Another thing I tried was overwriting email by creating an email = None in MyUser but that didn’t work either (and would be slightly more ugly).

Thanks in advance!

P.s. If you are wondering why; it’s more for curiousity than that it is really necessary for the application… But I think it’s good not to have unused columns in database.
P.p.s. I don’t want to change the Django files to manually remove ’email’ from user.

EDIT: Follow-up question here (for those who want to do the same thing) Before syncdb, delete field from standard Django model

  • 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-27T00:41:37+00:00Added an answer on May 27, 2026 at 12:41 am

    As you’ve discovered, model fields aren’t actually class attributes, even though they appear to be.

    Models are constructed by some very clever but complicated hacking around with metaclasses. When a model class definition is executed (the first time its models.py is imported), the metaclass runs through all the field definitions for that model, and calls the contribute_to_class method of each one. This ends up putting the actual fields into the new class’s _meta.fields property. So the model class itself doesn’t have the fields as direct properties.

    Then, when a model instance is actually instantiated, Django takes that list and directly sets the new instance’s attributes, using either the arguments to the constructor or the default values supplied by the fields. So, the value that’s accessed via the instance has no actual field code behind it: it’s a simple instance attribute.

    Anyway, the upshot of all this is that to remove a field from a model definition you just need to delete it from the Model._meta.fields list.

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

Sidebar

Related Questions

Probably this question was already asked before, but my google-fu and SO-Search did not
I note that this has been asked before but I haven't found an answer
NOTE : This question was originally asked way back in 2012. Before the decltype
Note: I asked this yesterday over at kiln.stackexchange.com , but haven't gotten an answer,
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost
Note: I've asked this question in a similiar format on superuser but it seems
I know this sort of question has been asked before , but I still
Note: This question was asked at a time when C# did not yet support
I know this question has been asked before and I read all the answers
I asked this before, but only theoretically, without an SSCCE. Now, I've created one,

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.