aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-03-02 08:31:01 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:53 +1200
commit735353ebd1171aa6e276654586e57c56f17842d5 (patch)
treed244cb34515eb12936fdf004b11a815e949f870f
parent0aa4b93d1838a012dc139328ad35fa333ab8a39d (diff)
downloadopenembedded-core-contrib-735353ebd1171aa6e276654586e57c56f17842d5.tar.gz
rrs/models: add fields for more flexible email handling
* Add a flag to say whether emails should be sent * Add fields for from/to/subject (to replace what's currently in settings) * Add user link for administrator to replace the hardcoded values in the email template Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--rrs/migrations/0006_maintplan_email.py41
-rw-r--r--rrs/models.py6
2 files changed, 47 insertions, 0 deletions
diff --git a/rrs/migrations/0006_maintplan_email.py b/rrs/migrations/0006_maintplan_email.py
new file mode 100644
index 0000000000..161af05a32
--- /dev/null
+++ b/rrs/migrations/0006_maintplan_email.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('rrs', '0005_release_plan_nonnull'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='maintenanceplan',
+ name='admin',
+ field=models.ForeignKey(blank=True, null=True, help_text='Plan administrator', to=settings.AUTH_USER_MODEL),
+ ),
+ migrations.AddField(
+ model_name='maintenanceplan',
+ name='email_enabled',
+ field=models.BooleanField(verbose_name='Enable emails', default=False, help_text='Enable automatically sending report emails for this plan'),
+ ),
+ migrations.AddField(
+ model_name='maintenanceplan',
+ name='email_from',
+ field=models.CharField(max_length=255, blank=True, help_text='Sender for automated emails'),
+ ),
+ migrations.AddField(
+ model_name='maintenanceplan',
+ name='email_subject',
+ field=models.CharField(max_length=255, blank=True, default='[Recipe reporting system] Upgradable recipe name list', help_text='Subject line of automated emails'),
+ ),
+ migrations.AddField(
+ model_name='maintenanceplan',
+ name='email_to',
+ field=models.CharField(max_length=255, blank=True, help_text='Recipient for automated emails (separate multiple addresses with ;)'),
+ ),
+ ]
diff --git a/rrs/models.py b/rrs/models.py
index 61740bf9de..a71d1b8ed9 100644
--- a/rrs/models.py
+++ b/rrs/models.py
@@ -12,6 +12,7 @@ sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '../
from datetime import date
from django.db import models
+from django.contrib.auth.models import User
from layerindex.models import Recipe, LayerBranch
@@ -19,6 +20,11 @@ class MaintenancePlan(models.Model):
name = models.CharField(max_length=50, unique=True)
description = models.TextField(blank=True)
updates_enabled = models.BooleanField('Enable updates', default=True, help_text='Enable automatically updating metadata for this plan via the update scripts')
+ email_enabled = models.BooleanField('Enable emails', default=False, help_text='Enable automatically sending report emails for this plan')
+ email_subject = models.CharField(max_length=255, blank=True, default='[Recipe reporting system] Upgradable recipe name list', help_text='Subject line of automated emails')
+ email_from = models.CharField(max_length=255, blank=True, help_text='Sender for automated emails')
+ email_to = models.CharField(max_length=255, blank=True, help_text='Recipient for automated emails (separate multiple addresses with ;)')
+ admin = models.ForeignKey(User, blank=True, null=True, help_text='Plan administrator')
def __str__(self):
return '%s' % (self.name)