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

254
Views
How to get List from Django Model (instead of Map of fields)

I have a Model called Patient. In this table I have a field:id and condition. So, If I want to get the ids given the condition, I can use this following syntax.

ids = list(Patient.objects.filter(condition='sick').values(id))

So the ids will contains a list of map:

ids = [{id: 123}, {id=345}, ...]

However, instead of map, I want to simply get the list like shown below:

ids = [123, 345, ...]

How can I achieve this from Django query?

Thanks.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Patient.objects.filter(condition='sick').values_list(id, flat=True)
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!