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

  • Home
  • SEARCH
  • 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 7029513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:32:56+00:00 2026-05-28T00:32:56+00:00

I have a django application which has one main table/model which references various ‘lookup’

  • 0

I have a django application which has one main table/model which references various ‘lookup’ tables. So for example : Client is the main table and it references the TitleCode, OccupationCode etc etc via a foreign key relationship. The ‘lookup’ tables are all pretty similar in structure (PK,Code,Display_Value). The obvious way to do this in django is to have an explicit class deriving from model.Models for each lookup table. It becomes a bit repetitive and when you have semi-custom admin forms for each table then its even more cumbersome. Any ideas? I was thinking of creating a base class implementing the actual model definition in the base and then to derive the specific lookup tables/models from these base classes. I’m going to check if this is doable now…

  • 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-28T00:32:56+00:00Added an answer on May 28, 2026 at 12:32 am

    Just create an abstract model called Code and inherit the specific classes from it (TitleCode, OccupationCode, etc…). ModelForms can be used for all of them, not much code.

    Another solution would be to just make a Code class and a CodeType class…put all fields in there that you might need, making them optional if they are in some types and not others. Then the Code object would have a FK to CodeType.

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

Sidebar

Related Questions

I have a Django application which edits a database table, which another application polls
I am implementing an application with django, which has a model with a FileField:
I have a Gunicorn server running a Django application which has a tendency to
I have a web application written in Django that has one specific page I'd
I have a App Engine/Python/Django application which has grown and been modified over the
I have two models in my Django 1.1.1 application: class UserRequest(models.Model): # blah blah
I have a reviews/ratings web application, a la Digg. My django app content has
I am in the middle of developing a Django application, which has quite complicated
so I'm working on a django application where I have a model Event. Each
I have a Django application, myApp. In it, there's a tests.py file which defines

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.