From patchwork Wed Oct 16 22:44:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Herland X-Patchwork-Id: 1178204 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46tnSM0wFnz9sCJ for ; Thu, 17 Oct 2019 09:45:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=herland.net Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46tnSK1l0zzDr6d for ; Thu, 17 Oct 2019 09:45:21 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.221.47; helo=mail-wr1-f47.google.com; envelope-from=jherland@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=herland.net Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46tnRp0Cx8zDr6d for ; Thu, 17 Oct 2019 09:44:51 +1100 (AEDT) Received: by mail-wr1-f47.google.com with SMTP id p14so102195wro.4 for ; Wed, 16 Oct 2019 15:44:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UqoKK0JWowjKQq9ii1VG3EGWGArtaqB+TqFZydmMcXg=; b=Ot4NkUbwI4uxA9UM1dk3zdltXahioXaIYv1ZbM+OPCGpPv52ETe2pjwoKAbO6H+d6l jXTAfsC0y91mBneHb5JF6MjqSkBeB70FFOHAdumz4Ybe8ST6N7dtJpF5dzN3v+l1nYKA tM2FQHEw5qK0uJfHNHHKVonBlcWKepSVrD/P3MkRKUmaCprf5pTwGs2BMrOhXZ4mEh27 HfkSaO4SM9K3EixsAwV+OtleVx2HUzqm4aU99mcAJiNDp5VETHDT9I6LyA/rrJyYquFQ RVIGekRmc+Z60RTI+K7jiZVIq9fIG0y5GWnN53u0q9fpyDfiHpw4ZM6TJ9LKVZHu7JCX h5pw== X-Gm-Message-State: APjAAAU7xB/PKeftoRvVbvfMkJmIvuPgvzZgW4hpEhJPFi3kLgV7YaG7 Jh6pXiFBKf1owehrDc8gCkLCwlyjOTc= X-Google-Smtp-Source: APXvYqxGJTTEbI6zcEwSRwApK7X1FwC31Hkm2wd0XD/C19tJM/IteF3gPNnYf7waULHm2GLAi+GrSQ== X-Received: by 2002:a05:6000:1288:: with SMTP id f8mr165793wrx.111.1571265888307; Wed, 16 Oct 2019 15:44:48 -0700 (PDT) Received: from beta.cisco.com ([173.38.220.34]) by smtp.gmail.com with ESMTPSA id w4sm198364wrv.66.2019.10.16.15.44.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Oct 2019 15:44:47 -0700 (PDT) From: Johan Herland To: patchwork@lists.ozlabs.org Subject: [PATCH v3 1/3] models.Event: Add the user responsible for the event Date: Thu, 17 Oct 2019 00:44:40 +0200 Message-Id: <20191016224442.9211-2-johan@herland.net> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20191016224442.9211-1-johan@herland.net> References: <20191016224442.9211-1-johan@herland.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mauro Carvalho Chehab Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" 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 Signed-off-by: Johan Herland Reviewed-by: Stephen Finucane Reviewed-by: Andrew Donnellan --- 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