diff mbox

[01/10] models: Add DelegationRule object

Message ID 1448712886-3221-2-git-send-email-mchehab@osg.samsung.com
State Accepted
Delegated to: Stephen Finucane
Headers show

Commit Message

Mauro Carvalho Chehab Nov. 28, 2015, 12:14 p.m. UTC
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Delegation rules are used to automatically set the delegate of a patch
based on the files touched by the patch.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 patchwork/admin.py  | 9 ++++++++-
 patchwork/models.py | 8 ++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

Comments

Stephen Finucane Jan. 6, 2016, 5:11 p.m. UTC | #1
On 28 Nov 10:14, Mauro Carvalho Chehab wrote:
> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Delegation rules are used to automatically set the delegate of a patch
> based on the files touched by the patch.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

When combined with the priority field patch...

Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane Jan. 19, 2016, 9:18 p.m. UTC | #2
On 06 Jan 17:11, Finucane, Stephen wrote:
> On 28 Nov 10:14, Mauro Carvalho Chehab wrote:
> > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> > Delegation rules are used to automatically set the delegate of a patch
> > based on the files touched by the patch.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> 
> When combined with the priority field patch...
> 
> Acked-by: Stephen Finucane <stephen.finucane@intel.com>

Merged.
diff mbox

Patch

diff --git a/patchwork/admin.py b/patchwork/admin.py
index eb8daa1eced2..e05c8bc7cf03 100644
--- a/patchwork/admin.py
+++ b/patchwork/admin.py
@@ -1,9 +1,16 @@ 
 from django.contrib import admin
 from patchwork.models import Project, Person, UserProfile, State, Patch, \
-         Comment, Bundle, Tag
+         Comment, Bundle, Tag, DelegationRule
+
+class DelegationRuleInline(admin.TabularInline):
+    model = DelegationRule
+    fields = ('path', 'user')
 
 class ProjectAdmin(admin.ModelAdmin):
     list_display = ('name', 'linkname','listid', 'listemail')
+    inlines = [
+        DelegationRuleInline,
+    ]
 admin.site.register(Project, ProjectAdmin)
 
 class PersonAdmin(admin.ModelAdmin):
diff --git a/patchwork/models.py b/patchwork/models.py
index c2b8a9c9408d..1bd9af24b510 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -78,6 +78,14 @@  class Project(models.Model):
         ordering = ['linkname']
 
 
+class DelegationRule(models.Model):
+    user = models.ForeignKey(User)
+    path = models.CharField(max_length=255)
+    project = models.ForeignKey(Project)
+
+    def __unicode__(self):
+        return self.path
+
 class UserProfile(models.Model):
     user = models.OneToOneField(User, unique = True, related_name='profile')
     primary_project = models.ForeignKey(Project, null = True, blank = True)