From patchwork Sun Dec 1 01:49:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Herland X-Patchwork-Id: 1202772 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 47QWRs6ywZz9sP3 for ; Sun, 1 Dec 2019 12:51:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=herland.net Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47QWRs5VhFzDqgs for ; Sun, 1 Dec 2019 12:51:05 +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.208.172; helo=mail-lj1-f172.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-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 47QWQm28KwzDqf1 for ; Sun, 1 Dec 2019 12:50:04 +1100 (AEDT) Received: by mail-lj1-f172.google.com with SMTP id m6so28498708ljc.1 for ; Sat, 30 Nov 2019 17:50:04 -0800 (PST) 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=90aaKa+TcKFClBOzNqTTJvFiP8UyhnLfiYER23t9y9g=; b=QsZqpBTmYjozbZGhJf5YmXMh4R5qrPx1EiqEyJx2Q+sOIOBw1PJT6DqB0/1MR2EmDn 7KquU2IplBx3hjsopbWICXA7jyTykCwmytu/wEEYRFFgbP0dCN+gOnMxZ3realLb9O8y nP57ii7gr3i3xaQTpielTB781WESoDscrrZ9qGQHA2dA5ZMLVwot+K6bt4mzzQpHIABe zrwhVzIYkEYFuDeVpS5iWVHK7MigaBz2tgrFqpx3ZLkpyXfpoWQ9/3yAoWBApSMt5PAu LtSduPjWG8KvCKayz39If6DbhqVCsivgYs4B0wBDx1JcpBCWYjwhkaC1wMZi0GooNsk9 CC5w== X-Gm-Message-State: APjAAAUkDobMANz2aP1c2VstnmbJ7dDZpPuPxyK9GCVJKLrxr2IBHb9V R27HUl1ennC1veb3KEN7rc7BHOuT X-Google-Smtp-Source: APXvYqzD2vohD6zqCGCZl5DWv+B5HTCV951pj5dhD+Rq78g9C6ptd2srt7jD2vly4TUk50kE09rTBg== X-Received: by 2002:a2e:9708:: with SMTP id r8mr9727313lji.92.1575165001021; Sat, 30 Nov 2019 17:50:01 -0800 (PST) Received: from beta.herland (160.37-191-159.fiber.lynet.no. [37.191.159.160]) by smtp.gmail.com with ESMTPSA id d4sm12182426lfi.32.2019.11.30.17.49.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Nov 2019 17:50:00 -0800 (PST) From: Johan Herland To: patchwork@lists.ozlabs.org Subject: [PATCH v4 1/4] models.Event: Add the user responsible for the event Date: Sun, 1 Dec 2019 02:49:52 +0100 Message-Id: <20191201014955.1994-2-johan@herland.net> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20191201014955.1994-1-johan@herland.net> References: <20191201014955.1994-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 --- 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 a908dd5..b4f3bef 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -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