31👍
✅
From the documentation:
>>> from django.db.models import Max
>>> AuthorizedEmail.objects.aggregate(Max('added'))
And to fetch the value in the template:
{{ item.added__max }}
9👍
latest
returns the latest object in the table according to the added
date:
AuthorizedEmail.objects.filter(group=group).latest('added')
- Django python-rq — DatabaseError SSL error: decryption failed or bad record mac
- How to add data-attribute to django modelform modelchoicefield
- Programmatically sync the db in Django
- GenericForeignKey and Admin in Django
- Django-filter messing around with empty field
- Get foreign key objects in a single query
- Django long request timeout
2👍
Source:stackexchange.com