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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:46:36+00:00 2026-05-28T18:46:36+00:00

I need to provide my users a list of choices from a model which

  • 0

I need to provide my users a list of choices from a model which is stored in a separate legacy database. Foreign keys aren’t supported in django multi-db setups. The ideal choice would be to use a foreign key, but since thats not possible I need to some up with something else.

So instead I created an IntegerField on the other database and tried using choices to get a list of available options.

class OtherDBTable(models.Model):
    client = models.IntegerField(max_length=20, choices=Client.objects.values_list('id','name'))

the problem I’m having is that the choices seem to get populated once but never refreshed. How do I ensure that whenever the client list changes that those newest options area available to pick.

  • 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-28T18:46:37+00:00Added an answer on May 28, 2026 at 6:46 pm

    What I was really looking for was a way that I could simulate the behavior of a Foreign key field, at least as far as matching up ID’s go.

    There wasn’t a clear way to do this, since it doesn’t seem like you can actually specify an additional field when you instantiate a model (you can with forms, easily)

    In any case to deal with the problem, since the database is MySQL based, I ended up creating views from the tables I needed in the other database.

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

Sidebar

Related Questions

I need to provide some passwords, API keys and similar sensitive data in my
I need to provide a way to allow users to select 1 Subject, but
I need to convert a bunch of dates in a MySQL database from Pacific
I have a project which provides users with a list of current tasks that
I have a php site which has multiple php scripts. I need to provide
Is there any way to provide user log-in without the need for a DB.
I need to simply provide the content of a property to a custom User
I need (i.e. a customer requirement) to provide a custom keyboard for the user
I need to validate if the user's provided information is in the database, i've
I need to provide webpage (made for desktop browsers) to be usable on mobile

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.