Allow contributor emails to be blank
authorStephen Frost <sfrost@snowman.net>
Tue, 18 Jul 2017 19:29:24 +0000 (21:29 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 18 Jul 2017 19:29:24 +0000 (21:29 +0200)
Over the years, contributors come and go and we have many cases now where
the contributor's email address which we have is not valid.  As we really
don't want to show incorrect information on the webpage, allow contributor
email addresses to be blank for cases where we've discovered that the email
address is no longer valid.

pgweb/contributors/migrations/0003_make_email_nullable.py [new file with mode: 0644]
pgweb/contributors/models.py
templates/contributors/list.html

diff --git a/pgweb/contributors/migrations/0003_make_email_nullable.py b/pgweb/contributors/migrations/0003_make_email_nullable.py
new file mode 100644 (file)
index 0000000..6ec4cc1
--- /dev/null
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('contributors', '0002_hide_email'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='contributor',
+            name='email',
+            field=models.EmailField(null=False, blank=True),
+        ),
+    ]
index 7ccf57487268388d072d5cc9d6eb0928d43682d1..789e203e836f25b82d6804434d868dcc4110065c 100644 (file)
@@ -20,7 +20,7 @@ class Contributor(models.Model):
        ctype = models.ForeignKey(ContributorType)
        lastname = models.CharField(max_length=100, null=False, blank=False)
        firstname = models.CharField(max_length=100, null=False, blank=False)
-       email = models.EmailField(null=False, blank=False)
+       email = models.EmailField(null=False, blank=True)
        company = models.CharField(max_length=100, null=True, blank=True)
        companyurl = models.URLField(max_length=100, null=True, blank=True, verbose_name='Company URL')
        location = models.CharField(max_length=100, null=True, blank=True)
index d3f3c4fa7b091d79c876558fa5fc5b1fbe0e3b90..36a2f44d146b690eda6d472ab2e8042dd538b09f 100644 (file)
@@ -20,7 +20,7 @@
   {%for c in t.contributor_set.all %}
    {%if t.detailed%}
     <tr{%if forloop.last%} class="lastrow"{%endif%}>
-     <td class="colFirst">{{c.firstname}} {{c.lastname}} {%if t.showemail%}({{c.email|hidemail}}){%endif%}
+     <td class="colFirst">{{c.firstname}} {{c.lastname}} {%if t.showemail and c.email%}({{c.email|hidemail}}){%endif%}
       {%if c.company %}<br/><a href="{{c.companyurl}}">{{c.company}}</a>{%endif%}
       <br/>{{c.location}}</td>
      <td class="colLast">{{c.contribution}}</td>