Add "Modified" Column to Projects
monicabritton opened this issue · comments
Add a column to Projects page for "Date Modified". This should be the latest date in the Log, or the creation date if there are no entries in the log.
Make sure to optionally list it on projects list
This script updates the db based on logs or project creation date... whichever is later:
from glims.models import Project
from logger.models import Log
from django.contrib.contenttypes.models import ContentType
ct = ContentType.objects.get_for_model(Project)
for p in Project.objects.all():
log = Log.objects.filter(content_type=ct,object_id=p.id).order_by('-created').first()
if log:
modified = log.created
else:
modified = p.created
Project.objects.filter(id=p.id).update(modified=modified)
Done, changes are live.