Tuesday, February 27, 2024

Finding the last modified timestamp for a group of Models

I have an application which contains more than one Model, all descended from an abstract one. All the operational Models have created and modified fields with datetime timestamps. [How] can I get the Django ORM to bring me the last modified timestamp that will be the maximum of all createds and modifieds of all Models? Right now I have to use itertools for a quite convoluted expression over query sets of all the models involved.

It seems quite an obvious use case, and it can be implemented in pure SQL quite easily.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bff16a54-c807-4e21-977b-f10af338200bn%40googlegroups.com.

No comments:

Post a Comment