Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
how to configure django form to create select option with query specific?

how to configure django form to create select option with query specific. Example1, i need create a select with user below a group but if i use just model i have every user, and just need the users specific.

Example2. i have this models:

class Fruit(models.Model):
    name = models.CharField(max_length=150)
    color = models.CharField(max_length=150)

I Have this datas

[apple, red], [banana, yellow], [strammberry, red], [orange, orange]...

when i create my form i need select field that show me fruits color red. apple, strammberry.

but show me all fruit. apple, banana, strammberry, orange

what is the form to this do?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use a ChoiceField in your form, or if you want the choices to be determined by a query, then a ModelChoiceField.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!