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

400
Views
Django ORM - get() con order_by()

Quiero una mezcla de get() y order_by() como esta

 Model.objects.get(some=condition).order_by('name')

Quiero un solo resultado (no filtro) y ordenado por nombre al mismo tiempo.

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Qué tal si

 Model.objects.filter(some=condition).order_by('name').first()
about 4 years ago · Santiago Trujillo Report

0

get () no tomará order_by () ya que get solo devuelve un solo objeto y no puede ordenar por una fila.

y para ordenar por necesita varias filas para el pedido. use filter('su cláusula where').order_by('asc/desc')

Espero eso ayude

about 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!