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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:14:58+00:00 2026-06-02T16:14:58+00:00

How do I create a list view that calls multiple classes/models from my model.py

  • 0

How do I create a list view that calls multiple classes/models from my model.py file?

I have created my project, and app and my models. The models use a one-to-many relationship.

I am able to create a listview based on calling a single model, but not using multiple models (in this scenario 7 models).

Here are the models I want to call, with the the required model values that I want displayed in the listview are denoted by **:

class TypeAchievement(models.Model):
  typeAchievementID = models.AutoField(primary_key=True, db_column="TypeAchievementID")
  languageCodeID = models.ForeignKey(LanguageCode, db_column="LanguageCodeID")
  **typeAchievementDescriptionIntl = models.CharField(max_length=255, db_column="TypeAchievementDescriptionIntl")**
  typeAchievementDescriptionEng = models.CharField(max_length=255, db_column="TypeAchievementDescriptionEng")
  typeAchievementAltID = models.IntegerField(db_column="TypeAchievementAltID")
  class Meta:
    db_table="TypeAchievement"

class RIAchievement(models.Model):
  riAchievementID = models.AutoField(primary_key=True, db_column="RIAchievementID")
  userLanguageVersionID = models.ForeignKey(UserLanguageVersion, db_column="UserLanguageVersionID")
  typeAchievementID = models.ForeignKey(TypeAchievement, db_column="TypeAchievementID")
  **riAchievementTypeUserDescription = models.CharField(max_length=255, blank=True, null=True, db_column="RIAchievementTypeUserDescription")**
  **riAchievementDescription = models.TextField(max_length=2000, db_column="RIAchievementDescription")**
  auth_user_id = models.ForeignKey(auth_user, db_column="auth_user_id")
  class Meta:
    db_table="RIAchievement"

class UserLanguageVersion(models.Model):
  userLanguageVersionID = models.AutoField(primary_key=True, db_column="UserLanguageVersionID")
  auth_user_id = models.ForeignKey(auth_user, db_column="auth_user_id")
  languageCodeID = models.ForeignKey(LanguageCode, db_column="LanguageCodeID")
  class Meta:
    db_table="UserLanguageVersion"

class auth_user(models.Model):
  **auth_user_id = models.AutoField(primary_key=True, db_column="id")**
  username = models.CharField(max_length=30, unique=True, db_column="username")
  first_name = models.CharField(max_length=30, db_column="first_name")
  last_name = models.CharField(max_length=30, db_column="last_name")
  email = models.CharField(max_length=75, db_column="email")
  password = models.CharField(max_length=128, db_column="password")
  is_staff = models.BooleanField(db_column="is_staff")
  is_active = models.BooleanField(db_column="is_active")
  is_supervisor = models.BooleanField(db_column="is_supervisor")
  last_login = models.DateTimeField(db_column="last_login")
  date_joined = models.DateTimeField(db_column="date_joined")
  class Meta:
    db_table="auth_user"

class LanguageCode(models.Model):
  languagecodeID = models.AutoField(primary_key=True, db_column="LanguageCodeID")
  **languageCodeDescription = models.CharField(max_length=10, db_column="LanguageCodeDescription")**
  baseLanguageCode = models.CharField(max_length=10, db_column="BaseLanguageCode")
  languageNameEng = models.CharField(max_length=255, db_column="LanguageNameEng")
  altLanguageNameEng = models.CharField(max_length=255, blank=True, null=True, db_column="AltLanguageNameEng")
  **languageNameNative = models.CharField(max_length=255, db_column="LanguageNameNative")**
  altLanguageNameNative = models.CharField(max_length=255, blank=True, null=True, db_column="AltLanguageNameNative")
  **iso639_1 = models.CharField(max_length=10, blank=True, null=True, db_column="ISO639_1")**
  iso639_2T = models.CharField(max_length=10, db_column="ISO639_2T")
  iso639_2B = models.CharField(max_length=10, db_column="ISO639_2B")
  iso639_X = models.CharField(max_length=10, db_column="ISO639_X")
  languageDirectionID = models.ForeignKey(LanguageDirection, default=1, db_column="LanguageDirectionID")
  class Meta:
    db_table="LanguageCode"

class LanguageDirection(models.Model):
  languageDirectionID = models.AutoField(primary_key=True, db_column="LanguageDirectionID")
  **languageDirectionDescription = models.CharField(max_length=20, db_column="LanguageDirectionDescription")**
  **languageDirDescription = models.CharField(max_length=20, db_column="LanguageDirDescription")**
  **textAlign = models.CharField(max_length=20, db_column="TextAlign")**
  **oppositeLanguageDirectionDescription = models.CharField(max_length=20, db_column="OppositeLanguageDirectionDescription")**
  **oppositeLanguageDirDescription = models.CharField(max_length=20, db_column="OppositeLanguageDirDescription")**
  **oppositeTextAlign = models.CharField(max_length=20, db_column="OppositeTextAlign")**
  class Meta:
    db_table="LanguageDirection"

class Flag(models.Model):
  flagID = models.AutoField(primary_key=True, db_column="FlagID")
  languageCodeID = models.ForeignKey(LanguageCode, db_column="LanguageCodeID")
  **flagIconPath = models.CharField(max_length=255, db_column="FlagIconPath")**
  flagDescription = models.CharField(max_length=255, db_column="FlagDescription")
  flagInformation = models.CharField(max_length=255, db_column="FlagInformation")
  class Meta:
    db_table="Flag"
  • 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-02T16:14:59+00:00Added an answer on June 2, 2026 at 4:14 pm

    You can get linked objects from the main one. In your case – iterate over list of RIAchievement and get other data as {{ riachievement.userLanguageVersionID.languageCodeID.languageDirectionID.textAlign }}

    P.S. Also, please format code according to pep8 even it is autogenerated from the database.

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

Sidebar

Related Questions

We have created a new List View Style that shows thumbnails from a picture
I have created a list view that displays the names and dates of items
I've created a listview that's filled up with a list of guitars from the
I am working on an application, and from a list view I create a
I have a list view that is displaying data using the gridview. This list
To be more specific, I have an app that has multiple tableViews that drill
I have created a compound control that I am reusing in multiple activities. This
I need to create and populate a ListView with 3 strings that come from
I have a listview with several items that are created dynamically, each has two
I have created a UserControl that has a ListView in it. The ListView is

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.