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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:55:54+00:00 2026-06-01T19:55:54+00:00

I have been writing my first few Django models and wanted to take a

  • 0

I have been writing my first few Django models and wanted to take a look at the base class that all models extend (example: “class Poll(models.Model”) but could not find the Model base class. I checked the source on github and when I browsed to the django.db.models directory I was surprised to not find a “Model.py” file that I could look at. Is this file generated? Or does the class Model live somewhere else? Or is there some python package magic going on that I’m not familiar with?

  • 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-01T19:55:55+00:00Added an answer on June 1, 2026 at 7:55 pm

    As has been remarked before, Python is not Java. In particular, there’s nothing in Python that says that a class has to live in a file with the same name as the class.

    As San4ez points out, the Model class lives in django.db.models.base, and is imported into the __init__.py file in that directory so that it can be referenced directly as models.Model. This isn’t any kind of magic, just normal idiomatic Python.

    However, once you look into the code for the class itself, you’ll find that it actually does consist of quite a lot of Python magic, specifically around metaclasses. But that’s a different question.

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

Sidebar

Related Questions

I have been writing a small java application (my first!), that does only a
I have been writing DLL on C++, that will be use in C#. DLL
The Disclaimer First of all, I know this question (or close variations) have been
I have been writing a code that either accepts or rejects a string of
I have been writing a program that is quite complex compared to what I
I have been writing my Rails application with Cucumber in TDD mode: Tests first,
Im new to android. I have been writing my first app, I testing it
I have been writing php and mySQL functions all day and as I was
I have been writing linear winforms for couple of months and now I am
I have been writing a SOAP client application in C++ on Ubuntu using OpenSSL

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.