]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
models.Event: Add the user responsible for the event
authorJohan Herland <johan@herland.net>
Sun, 1 Dec 2019 01:49:52 +0000 (02:49 +0100)
committerStephen Finucane <stephen@that.guru>
Sun, 1 Dec 2019 11:59:17 +0000 (11:59 +0000)
This allows using the events as a kind of audit log, to see how a
patch came to its current state/delegate.

Signed-off-by: Johan Herland <johan@herland.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
patchwork/migrations/0037_event_actor.py [new file with mode: 0644]
patchwork/models.py

diff --git a/patchwork/migrations/0037_event_actor.py b/patchwork/migrations/0037_event_actor.py
new file mode 100644 (file)
index 0000000..719f514
--- /dev/null
@@ -0,0 +1,21 @@
+# Generated by Django 2.2.6 on 2019-10-08 04:21
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+        ('patchwork', '0036_project_commit_url_format'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='event',
+            name='actor',
+            field=models.ForeignKey(blank=True, help_text=b'The user that caused/created this event.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
+        ),
+    ]
index a908dd5cff40c218bd1c9af3cad908c2efec6a48..b4f3bef685fbff309164f96d201f29865b5dcd75 100644 (file)
@@ -955,6 +955,10 @@ class Event(models.Model):
     date = models.DateTimeField(
         default=datetime.datetime.utcnow,
         help_text='The time this event was created.')
+    actor = models.ForeignKey(
+        User, related_name='+', null=True, blank=True,
+        on_delete=models.SET_NULL,
+        help_text='The user that caused/created this event.')
 
     # event object