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

164
Views
¿Cómo obtengo un objeto por nombre y marca de tiempo más alta?

Quiero obtener la transacción que pertenece a external_id=1 y tiene la marca de tiempo más alta.

he intentado esto

 max_rating = Transaction.objects.aggregate(organisation_id_from_partner=organisation_id, highest_timestamp=Max('timestamp'))

Pero obtengo TypeError: QuerySet.aggregate() received non-expression(s): 1.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Dentro del agregado, solo puede escribir la función Agregado. Prueba esto

 max_rating = Transaction.objects.filter(organisation_id_from_partner=organisation_id).order_by('-timestamp').first()
over 4 years ago · Santiago Trujillo Report

0

Puede acortar ligeramente la respuesta de @shafik usando .latest(…) [Django-doc] :

 max_rating = Transaction.objects.filter( organisation_id_from_partner=organisation_id ) .latest('timestamp')
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!