Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
How do I get the an object by name and highest timestamp

I want to fetch the transaction belonging to external_id=1 and has the highest timestamp.

I have tried this

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

But I get TypeError: QuerySet.aggregate() received non-expression(s): 1.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Inside aggregate, you can only write Aggregate function. Try this

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

0

You can slightly shorten the answer by @shafik by using .latest(…) [Django-doc]:

max_rating = Transaction.objects.filter(
    organisation_id_from_partner=organisation_id
).latest('timestamp')
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda