diff --git a/.gitattributes b/.gitattributes
index bd9fccc764b415cc0c845c59084c4c203dfaba2a..6547d5b1ee0db7672e72a9e444d80037568f5b94 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4245,7 +4245,7 @@ SAS/LSMR/src/lsmr/lsmrapp/__init__.py -text
 SAS/LSMR/src/lsmr/lsmrapp/admin.py -text
 SAS/LSMR/src/lsmr/lsmrapp/apps.py -text
 SAS/LSMR/src/lsmr/lsmrapp/migrations/0001_initial.py -text
-SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180713_0749.py -text
+SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180713_1002.py -text
 SAS/LSMR/src/lsmr/lsmrapp/migrations/0003_populate.py -text
 SAS/LSMR/src/lsmr/lsmrapp/migrations/CMakeLists.txt -text
 SAS/LSMR/src/lsmr/lsmrapp/migrations/__init__.py -text
diff --git a/SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180713_0749.py b/SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180713_1002.py
similarity index 92%
rename from SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180713_0749.py
rename to SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180713_1002.py
index de6c84487c6a38cb1b4b5921a935b9083d1d5a2a..a098ab9640de0bcba92f66e67a988d767f6f004a 100644
--- a/SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180713_0749.py
+++ b/SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180713_1002.py
@@ -1,4 +1,4 @@
-# Generated by Django 2.0.6 on 2018-07-13 07:49
+# Generated by Django 2.0.6 on 2018-07-13 10:02
 
 import django.contrib.postgres.fields
 import django.contrib.postgres.fields.jsonb
@@ -139,7 +139,7 @@ class Migration(migrations.Migration):
                 ('priority', models.IntegerField(default=0)),
                 ('can_trigger', models.BooleanField(default=False)),
                 ('private_data', models.BooleanField(default=True)),
-                ('cycle', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='projects', to='lsmrapp.Cycle')),
+                ('cycle', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='projects', to='lsmrapp.Cycle')),
             ],
             options={
                 'abstract': False,
@@ -317,10 +317,10 @@ class Migration(migrations.Migration):
                 ('selection_doc', django.contrib.postgres.fields.jsonb.JSONField()),
                 ('consumer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='consumed_by', to='lsmrapp.WorkRequestDraft')),
                 ('dataformat', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lsmrapp.DataformatChoice')),
-                ('draft', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lsmrapp.WorkRelationSelectionTemplate')),
                 ('input_role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inputs_work_request_relation_draft', to='lsmrapp.WorkIORole')),
                 ('output_role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='outputs_work_request_relation_draft', to='lsmrapp.WorkIORole')),
                 ('producer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='produced_by', to='lsmrapp.WorkRequestDraft')),
+                ('selection_template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lsmrapp.WorkRelationSelectionTemplate')),
             ],
             options={
                 'abstract': False,
@@ -363,25 +363,40 @@ class Migration(migrations.Migration):
             name='producer',
             field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='produced_by', to='lsmrapp.WorkRequestBlueprint'),
         ),
+        migrations.AddField(
+            model_name='workrequestrelationblueprint',
+            name='selection_template',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lsmrapp.WorkRelationSelectionTemplate'),
+        ),
+        migrations.AddField(
+            model_name='workrequestdraft',
+            name='template',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lsmrapp.WorkRequestTemplate'),
+        ),
         migrations.AddField(
             model_name='workrequestblueprint',
             name='draft',
             field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='related_work_request_blueprint', to='lsmrapp.WorkRequestDraft'),
         ),
+        migrations.AddField(
+            model_name='workrequestblueprint',
+            name='run_blueprint',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lsmrapp.RunBlueprint'),
+        ),
         migrations.AddField(
             model_name='workrequestblueprint',
             name='template',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='lsmrapp.WorkRequestTemplate'),
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lsmrapp.WorkRequestTemplate'),
         ),
         migrations.AddField(
             model_name='workiorole',
             name='inputs',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='role_input', to='lsmrapp.WorkRequestTemplate'),
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='role_input', to='lsmrapp.WorkRequestTemplate'),
         ),
         migrations.AddField(
             model_name='workiorole',
             name='outputs',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='role_output', to='lsmrapp.WorkRequestTemplate'),
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='role_output', to='lsmrapp.WorkRequestTemplate'),
         ),
         migrations.AddField(
             model_name='workiorole',
@@ -391,13 +406,18 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='rundraft',
             name='generator_source',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='lsmrapp.RunSet'),
+            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='lsmrapp.RunSet'),
         ),
         migrations.AddField(
             model_name='rundraft',
             name='run_set',
             field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='run_drafts', to='lsmrapp.RunSet'),
         ),
+        migrations.AddField(
+            model_name='rundraft',
+            name='template',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lsmrapp.RunTemplate'),
+        ),
         migrations.AddField(
             model_name='runblueprint',
             name='draft',
@@ -406,7 +426,7 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='runblueprint',
             name='template',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='lsmrapp.RunTemplate'),
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lsmrapp.RunTemplate'),
         ),
         migrations.AddField(
             model_name='defaultworkrequesttemplate',
diff --git a/SAS/LSMR/src/lsmr/lsmrapp/migrations/0003_populate.py b/SAS/LSMR/src/lsmr/lsmrapp/migrations/0003_populate.py
index 414c14cf8cea6ffcfdeb73c307bd440e0fc47525..d21b6967fa027d400f63971599ff41c7dc32fe63 100644
--- a/SAS/LSMR/src/lsmr/lsmrapp/migrations/0003_populate.py
+++ b/SAS/LSMR/src/lsmr/lsmrapp/migrations/0003_populate.py
@@ -5,7 +5,7 @@ from ..populate import *
 class Migration(migrations.Migration):
 
     dependencies = [
-        ('lsmrapp', '0002_auto_20180713_0749'),
+        ('lsmrapp', '0002_auto_20180713_1002'),
     ]
 
     operations = [ migrations.RunPython(populate_choices) ]
diff --git a/SAS/LSMR/src/lsmr/lsmrapp/models/specification.py b/SAS/LSMR/src/lsmr/lsmrapp/models/specification.py
index e4f334eebea01ac17e244dd317b9356d8f33aa4c..95bb0e1a3f895c6d0a418eef389815516f4c2b22 100644
--- a/SAS/LSMR/src/lsmr/lsmrapp/models/specification.py
+++ b/SAS/LSMR/src/lsmr/lsmrapp/models/specification.py
@@ -30,6 +30,9 @@ class NamedCommon(BasicCommon):
     name = CharField(max_length=30)
     description = CharField(max_length=255)
 
+    def __str__(self):
+        return self.name
+
     class Meta:
         abstract = True
 
@@ -119,8 +122,8 @@ class WorkIORole(BasicCommon):
     role = ForeignKey('RoleChoice', null=False, on_delete=CASCADE)
     datatype = ForeignKey('DatatypeChoice', null=False, on_delete=CASCADE)
     dataformat = ForeignKey('DataformatChoice', null=False, on_delete=CASCADE)              # todo: <--- this needs to be an array of dataformats!
-    outputs = ForeignKey("WorkRequestTemplate", related_name='role_output', on_delete=CASCADE, null=True)
-    inputs = ForeignKey("WorkRequestTemplate", related_name='role_input', on_delete=CASCADE, null=True)
+    outputs = ForeignKey("WorkRequestTemplate", related_name='role_output', on_delete=CASCADE)
+    inputs = ForeignKey("WorkRequestTemplate", related_name='role_input', on_delete=CASCADE)
 
 #
 # Templates
@@ -132,9 +135,6 @@ class Template(NamedCommon):
     version = CharField(max_length=30)
     schema = JSONField()
 
-    def __str__(self):
-        return self.name
-
     class Meta:
         abstract = True
 
@@ -186,7 +186,7 @@ class Cycle(NamedCommon):
 
 
 class Project(NamedCommon):
-    cycle = ForeignKey('Cycle', related_name='projects', on_delete=CASCADE)
+    cycle = ForeignKey('Cycle', related_name='projects', on_delete=CASCADE, null=True)
     priority = IntegerField(default=0)  # todo: define a value for the default priority
     can_trigger = BooleanField(default=False)
     private_data = BooleanField(default=True)
@@ -204,13 +204,14 @@ class RunDraft(NamedCommon):
     copy_reason = ForeignKey('CopyReasonChoice', null=False, on_delete=CASCADE)
     generator_param = CharField(max_length=200)  # todo: check if the field size is good enough
     run_set = ForeignKey(RunSet, related_name='run_drafts', on_delete=CASCADE)
-    generator_source = ForeignKey(RunSet, on_delete=SET_NULL, null=True)
+    generator_source = ForeignKey(RunSet, on_delete=CASCADE, null=True)
+    template = ForeignKey(RunTemplate, on_delete=CASCADE)
 
 
 class RunBlueprint(NamedCommon):
     requirements_doc = JSONField()
     do_cancel = BooleanField()
-    template = ForeignKey('RunTemplate', on_delete=SET_NULL, null=True)
+    template = ForeignKey('RunTemplate', on_delete=CASCADE)
     draft = ForeignKey('RunDraft', related_name='related_run_blueprint', on_delete=CASCADE)
 
 
@@ -218,13 +219,15 @@ class WorkRequestDraft(NamedCommon):
     requirements_doc = JSONField()
     copies = ForeignKey('WorkRequestDraft', related_name="copied_from", on_delete=SET_NULL, null=True)
     copy_reason = ForeignKey('CopyReasonChoice', null=False, on_delete=CASCADE)
+    template = ForeignKey('WorkRequestTemplate', on_delete=CASCADE)
 
 
 class WorkRequestBlueprint(NamedCommon):
     requirements_doc = JSONField()
     do_cancel = BooleanField()
-    template = ForeignKey('WorkRequestTemplate', on_delete=SET_NULL, null=True)
+    template = ForeignKey('WorkRequestTemplate', on_delete=CASCADE)
     draft = ForeignKey('WorkRequestDraft', related_name='related_work_request_blueprint', on_delete=CASCADE)
+    run_blueprint = ForeignKey('RunBlueprint', on_delete=CASCADE)
 
 
 class WorkRequestRelationDraft(BasicCommon):
@@ -234,7 +237,7 @@ class WorkRequestRelationDraft(BasicCommon):
     consumer = ForeignKey(WorkRequestDraft, related_name='consumed_by', on_delete=CASCADE)
     input_role = ForeignKey(WorkIORole, related_name='inputs_work_request_relation_draft', on_delete=CASCADE)
     output_role = ForeignKey(WorkIORole, related_name='outputs_work_request_relation_draft', on_delete=CASCADE)
-    draft = ForeignKey(WorkRelationSelectionTemplate, on_delete=CASCADE)
+    selection_template = ForeignKey(WorkRelationSelectionTemplate, on_delete=CASCADE)
 
 
 class WorkRequestRelationBlueprint(BasicCommon):
@@ -245,4 +248,5 @@ class WorkRequestRelationBlueprint(BasicCommon):
     input_role = ForeignKey(WorkIORole, related_name='inputs_work_request_relation_blueprint', on_delete=CASCADE)
     output_role = ForeignKey(WorkIORole, related_name='outputs_work_request_relation_blueprint', on_delete=CASCADE)
     draft = ForeignKey(WorkRequestRelationDraft, on_delete=CASCADE)
+    selection_template = ForeignKey(WorkRelationSelectionTemplate, on_delete=CASCADE)