From 0e8ce599e99b0a78f8163a1b8806d10af650a8ab Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sun, 7 Feb 2016 17:25:35 +0100
Subject: [PATCH] Add supervisor field to theses

---
 theses/forms.py  | 2 +-
 theses/models.py | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/theses/forms.py b/theses/forms.py
index 4f9d46951..30370f461 100644
--- a/theses/forms.py
+++ b/theses/forms.py
@@ -17,7 +17,7 @@ THESIS_REFUSAL_CHOICES = (
 class RequestThesisLinkForm(forms.ModelForm):
     class Meta:
         model = ThesisLink
-        fields = ['type', 'discipline', 'domain', 'specialization', 'title', 'author', 'institution', 'defense_date', 'pub_link', 'abstract']
+        fields = ['type', 'discipline', 'domain', 'specialization', 'title', 'author', 'supervisor', 'institution', 'defense_date', 'pub_link', 'abstract']
 
     def __init__(self, *args, **kwargs):
         super(RequestThesisLinkForm, self).__init__(*args, **kwargs)
diff --git a/theses/models.py b/theses/models.py
index d0ee55208..28ada3ebb 100644
--- a/theses/models.py
+++ b/theses/models.py
@@ -29,6 +29,8 @@ class ThesisLink(models.Model):
     pub_link = models.URLField(verbose_name='URL (external repository)')
     author = models.CharField(max_length=1000)
     author_as_cont = models.ManyToManyField (Contributor, blank=True, related_name='author_cont')
+    supervisor = models.CharField(max_length=1000, default='')
+    supervisor_as_cont = models.ManyToManyField (Contributor, blank=True, verbose_name='supervisor(s)', related_name='supervisor_cont')
     institution = models.CharField(max_length=300, verbose_name='degree granting institution')
     defense_date = models.DateField(verbose_name='date of thesis defense')
     abstract = models.TextField(verbose_name='abstract, outline or summary')
@@ -59,6 +61,7 @@ class ThesisLink(models.Model):
         header += '<tr><td>Specialization: </td><td></td><td>' + journals_spec_dict[self.specialization] + '</td></tr>'
         header += '<tr><td>URL: </td><td>&nbsp;</td><td><a href="' + self.pub_link + '">' + self.pub_link + '</a></td></tr>'
         header += '<tr><td>Degree granting institution: </td><td>&nbsp;</td><td>' + self.institution + '</td></tr>'
+        header += '<tr><td>Supervisor(s): </td><td></td><td>' + self.supervisor + '</td></tr>'
         header += '<tr><td>Defense date: </td><td>&nbsp;</td><td>' + str(self.defense_date) + '</td></tr>'
         header += '</table>'
         return header
@@ -66,7 +69,7 @@ class ThesisLink(models.Model):
     def header_as_li (self):
         header = '<li><div class="flex-container">'
         header += '<div class="flex-whitebox0v"><p><a href="/theses/thesis/' + str(self.id) + '">' + self.title + '</a></p>'
-        header += '<p>' + thesis_type_dict[self.type] + ' thesis by ' + self.author + '</p>'
+        header += '<p>' + thesis_type_dict[self.type] + ' thesis by ' + self.author + ' (supervisor(s): ' + self.supervisor + ')</p>'
         header += '<p>in ' + disciplines_dict[self.discipline] + ', ' + journals_domains_dict[self.domain] + ' ' + journals_spec_dict[self.specialization] + '</p></div>'
         header += '<div class="flex-whitebox0v"><p>Defense date: ' + str(self.defense_date) + '</p><p>Latest activity: ' + self.latest_activity.strftime('%Y-%m-%d %H:%M') + '</p></div>'
         header += '</div></li>'
-- 
GitLab