diff mbox series

[v3,1/3] models.Event: Add the user responsible for the event

Message ID 20191016224442.9211-2-johan@herland.net
State Superseded
Headers show
Series Store the 'actor' responsible for events | expand

Commit Message

Johan Herland Oct. 16, 2019, 10:44 p.m. UTC
This allows using the events as a kind of audit log, to see how a
patch came to its current state/delegate.

Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Johan Herland <johan@herland.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
---
 patchwork/migrations/0037_event_actor.py | 21 +++++++++++++++++++++
 patchwork/models.py                      |  4 ++++
 2 files changed, 25 insertions(+)
 create mode 100644 patchwork/migrations/0037_event_actor.py

Comments

Andrew Donnellan Nov. 14, 2019, 5:07 a.m. UTC | #1
On 17/10/19 9:44 am, Johan Herland wrote:
> This allows using the events as a kind of audit log, to see how a
> patch came to its current state/delegate.
> 
> Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
> Signed-off-by: Johan Herland <johan@herland.net>
> Reviewed-by: Stephen Finucane <stephen@that.guru>

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>

> ---
>   patchwork/migrations/0037_event_actor.py | 21 +++++++++++++++++++++
>   patchwork/models.py                      |  4 ++++
>   2 files changed, 25 insertions(+)
>   create mode 100644 patchwork/migrations/0037_event_actor.py
> 
> diff --git a/patchwork/migrations/0037_event_actor.py b/patchwork/migrations/0037_event_actor.py
> new file mode 100644
> index 0000000..6607228
> --- /dev/null
> +++ b/patchwork/migrations/0037_event_actor.py
> @@ -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='The user that caused/created this event.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
> +        ),
> +    ]
> diff --git a/patchwork/models.py b/patchwork/models.py
> index c198bc2..b43c15a 100644
> --- a/patchwork/models.py
> +++ b/patchwork/models.py
> @@ -944,6 +944,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
>   
>
diff mbox series

Patch

diff --git a/patchwork/migrations/0037_event_actor.py b/patchwork/migrations/0037_event_actor.py
new file mode 100644
index 0000000..6607228
--- /dev/null
+++ b/patchwork/migrations/0037_event_actor.py
@@ -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='The user that caused/created this event.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
+        ),
+    ]
diff --git a/patchwork/models.py b/patchwork/models.py
index c198bc2..b43c15a 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -944,6 +944,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