From 21d3bcdc4d294ac627f4c89725f132a46f461135 Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Wed, 2 May 2018 18:13:53 +0200 Subject: [PATCH] Add datestamps to maillogs --- mails/migrations/0003_auto_20180502_1807.py | 27 +++++++++++++++++++++ mails/models.py | 3 +++ 2 files changed, 30 insertions(+) create mode 100644 mails/migrations/0003_auto_20180502_1807.py diff --git a/mails/migrations/0003_auto_20180502_1807.py b/mails/migrations/0003_auto_20180502_1807.py new file mode 100644 index 000000000..e1ad8409a --- /dev/null +++ b/mails/migrations/0003_auto_20180502_1807.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2018-05-02 16:07 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('mails', '0002_auto_20180313_1744'), + ] + + operations = [ + migrations.AddField( + model_name='maillog', + name='created', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AddField( + model_name='maillog', + name='latest_activity', + field=models.DateTimeField(auto_now=True), + ), + ] diff --git a/mails/models.py b/mails/models.py index f532cd406..e77a920cb 100644 --- a/mails/models.py +++ b/mails/models.py @@ -29,6 +29,9 @@ class MailLog(models.Model): from_email = models.CharField(max_length=254, blank=True) subject = models.CharField(max_length=254, blank=True) + created = models.DateTimeField(auto_now_add=True) + latest_activity = models.DateTimeField(auto_now=True) + objects = MailLogQuerySet.as_manager() def __str__(self): -- GitLab