new file mode 100644
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('patchwork', '0004_project_git_send_email_only'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Event',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(max_length=20)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='EventLog',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('event_time', models.DateTimeField(auto_now=True)),
+ ('event', models.ForeignKey(to='patchwork.Event')),
+ ('series', models.ForeignKey(to='patchwork.Series')),
+ ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True)),
+ ],
+ options={
+ 'ordering': ['-event_time'],
+ },
+ ),
+ ]
@@ -540,6 +540,18 @@ class SeriesRevisionPatch(models.Model):
unique_together = [('revision', 'patch'), ('revision', 'order')]
ordering = ['order']
+class Event(models.Model):
+ name = models.CharField(max_length=20)
+
+class EventLog(models.Model):
+ event = models.ForeignKey(Event)
+ event_time = models.DateTimeField(auto_now=True)
+ series = models.ForeignKey(Series)
+ user = models.ForeignKey(User, null=True)
+
+ class Meta:
+ ordering = ['-event_time']
+
class EmailConfirmation(models.Model):
validity = datetime.timedelta(days = settings.CONFIRMATION_VALIDITY_DAYS)
type = models.CharField(max_length = 20, choices = [
I'd like to be able to track the history of manipulations done on series (and probably its patches as well). To start with, I'm only interested in when series are created so I can export a RSS feed containing the new series. For the curious mind, a full event table for just one field seems a bit overkill. I have to mind to attach more properties to events. For instance link a state to an event so we can generically set the state of a series/patch when a certain event is created. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- patchwork/migrations/0005_event_eventlog.py | 36 +++++++++++++++++++++++++++++ patchwork/models.py | 12 ++++++++++ 2 files changed, 48 insertions(+) create mode 100644 patchwork/migrations/0005_event_eventlog.py