Wednesday, February 28, 2024

Re: Finding the last modified timestamp for a group of Models

https://docs.djangoproject.com/en/5.0/ref/applications/#django.apps.AppConfig.get_models

gets you an iterable of all models loaded
On Tuesday, February 27, 2024 at 8:53:32 AM UTC-5 Alex Guetsche wrote:
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/b138d163-29a3-4c45-a6fd-f0af6ef4d67bn%40googlegroups.com.

No comments:

Post a Comment