What I want to do is get the date of the last update across
relationships to figure out when the last update in an entire series
of related objects happened.

I'm pasting the relevant code of my models below but for example, I
want to be able to call a series_updated method on project that
returns the most recent date of a last_updated value from the project
or any of the related Releases or Activities.

I'm having trouble wrapping my head around this and would appreciate
any insight.


class Project(models.Model):
    last_updated = models.DateField(auto_now=True, auto_now_add=True)

    class Meta:
        get_latest_by = 'last_updated'
        ordering = ['last_updated']

class Release(models.Model):
    project_fk = models.ForeignKey(Project)
    last_updated = models.DateField(auto_now=True, auto_now_add=True)

    class Meta:
        get_latest_by = 'last_updated'
        ordering = ["project_fk", "internal_priority"]

class Activity(models.Model):
    release_fk = models.ForeignKey(Release)
    last_updated = models.DateField(auto_now=True, auto_now_add=True)

    class Meta:
        get_latest_by = 'last_updated'
        ordering = ['last_updated']

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to