Commit 467a9956 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Damien Lespiau
Browse files

models: Add DelegationRule object

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

v2: Port to fdo's patchwork (Damien)
Signed-off-by: Laurent Pinchart's avatarLaurent Pinchart <>
Signed-off-by: default avatarMauro Carvalho Chehab <>
Acked-by: default avatarStephen Finucane <>
parent 5169b28d
......@@ -22,11 +22,20 @@ from __future__ import absolute_import
from django.contrib import admin
from patchwork.models import (Project, Person, UserProfile, State, Patch,
Comment, Bundle, Tag, Test, TestResult)
Comment, Bundle, Tag, Test, TestResult,
class DelegationRuleInline(admin.TabularInline):
model = DelegationRule
fields = ('path', 'user', 'priority')
class ProjectAdmin(admin.ModelAdmin):
list_display = ('name', 'linkname', 'listid', 'listemail')
inlines = [
], ProjectAdmin)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('patchwork', '0015_remove_version_n_patches'),
operations = [
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('path', models.CharField(max_length=255)),
('priority', models.IntegerField(default=0)),
('project', models.ForeignKey(to='patchwork.Project')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
'ordering': ['-priority', 'path'],
unique_together=set([('path', 'project')]),
......@@ -125,6 +125,21 @@ def user_name(user):
auth.models.User.add_to_class('name', user_name)
class DelegationRule(models.Model):
user = models.ForeignKey(User)
path = models.CharField(max_length=255)
project = models.ForeignKey(Project)
priority = models.IntegerField(default=0)
def __str__(self):
return self.path
class Meta:
ordering = ['-priority', 'path']
unique_together = (('path', 'project'))
class UserProfile(models.Model):
user = models.OneToOneField(User, unique=True, related_name='profile')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment