Commit 1fe6ec24 authored by Damien Lespiau's avatar Damien Lespiau
Browse files

models: Add Event and EventLog models



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: default avatarDamien Lespiau <damien.lespiau@intel.com>
parent 64fda6d3
# -*- 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 = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment