From 3b6f269cfba6fdfbc143afc28b54e175703b3aeb Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Thu, 25 May 2017 09:54:49 -0400 Subject: [PATCH] Add ability to hide emails per contributor type This makes it possible to hide emails from past contributors, which are more likely to not be correct anyway. --- .../migrations/0002_hide_email.py | 19 +++++++++++++++++++ pgweb/contributors/models.py | 1 + templates/contributors/list.html | 6 +++--- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 pgweb/contributors/migrations/0002_hide_email.py diff --git a/pgweb/contributors/migrations/0002_hide_email.py b/pgweb/contributors/migrations/0002_hide_email.py new file mode 100644 index 00000000..1b7bc8f2 --- /dev/null +++ b/pgweb/contributors/migrations/0002_hide_email.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('contributors', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='contributortype', + name='showemail', + field=models.BooleanField(default=True), + ), + ] diff --git a/pgweb/contributors/models.py b/pgweb/contributors/models.py index fbd72b84..3359fb76 100644 --- a/pgweb/contributors/models.py +++ b/pgweb/contributors/models.py @@ -6,6 +6,7 @@ class ContributorType(models.Model): sortorder = models.IntegerField(null=False, default=100) extrainfo = models.TextField(null=True, blank=True) detailed = models.BooleanField(null=False, default=True) + showemail = models.BooleanField(null=False, default=True) purge_urls = ('/community/contributors/', ) diff --git a/templates/contributors/list.html b/templates/contributors/list.html index d349fd87..d3f3c4fa 100644 --- a/templates/contributors/list.html +++ b/templates/contributors/list.html @@ -20,7 +20,7 @@ {%for c in t.contributor_set.all %} {%if t.detailed%} - {{c.firstname}} {{c.lastname}} ({{c.email|hidemail}}) + {{c.firstname}} {{c.lastname}} {%if t.showemail%}({{c.email|hidemail}}){%endif%} {%if c.company %}
{{c.company}}{%endif%}
{{c.location}} {{c.contribution}} @@ -28,13 +28,13 @@ {%else%} {%if forloop.counter0|divisibleby:"2" %} - {{c.firstname}} {{c.lastname}}{%if c.email%} ({{c.email|hidemail}}){%endif%} + {{c.firstname}} {{c.lastname}}{%if t.showemail and c.email%} ({{c.email|hidemail}}){%endif%} {%if forloop.last%} {%endif%} {%else%} - {{c.firstname}} {{c.lastname}}{%if c.email%} ({{c.email|hidemail}}){%endif%} + {{c.firstname}} {{c.lastname}}{%if t.showemail and c.email%} ({{c.email|hidemail}}){%endif%} {%endif%} {%endif%} -- 2.39.5