Commit 97ba3353 authored by Tobias van der Werff's avatar Tobias van der Werff
Browse files

Add 'Display members' field for MemberGroup

parent 23b79eb4
...@@ -51,7 +51,8 @@ class CommitteeAdmin(TranslatedModelAdmin): ...@@ -51,7 +51,8 @@ class CommitteeAdmin(TranslatedModelAdmin):
filter_horizontal = ('permissions',) filter_horizontal = ('permissions',)
fields = ('name', 'description', 'photo', 'permissions', 'since', fields = ('name', 'description', 'photo', 'permissions', 'since',
'until', 'contact_mailinglist', 'contact_email', 'active') 'until', 'contact_mailinglist', 'contact_email', 'active',
'display_members')
def email(self, instance): def email(self, instance):
if instance.contact_email: if instance.contact_email:
...@@ -72,7 +73,8 @@ class SocietyAdmin(TranslatedModelAdmin): ...@@ -72,7 +73,8 @@ class SocietyAdmin(TranslatedModelAdmin):
filter_horizontal = ('permissions',) filter_horizontal = ('permissions',)
fields = ('name', 'description', 'photo', 'permissions', 'since', fields = ('name', 'description', 'photo', 'permissions', 'since',
'until', 'contact_mailinglist', 'contact_email', 'active') 'until', 'contact_mailinglist', 'contact_email', 'active',
'display_members')
def email(self, instance): def email(self, instance):
if instance.contact_email: if instance.contact_email:
...@@ -91,7 +93,8 @@ class BoardAdmin(TranslatedModelAdmin): ...@@ -91,7 +93,8 @@ class BoardAdmin(TranslatedModelAdmin):
filter_horizontal = ('permissions',) filter_horizontal = ('permissions',)
fields = ('name', 'description', 'photo', 'permissions', fields = ('name', 'description', 'photo', 'permissions',
'contact_mailinglist', 'contact_email', 'since', 'until',) 'contact_mailinglist', 'contact_email', 'since', 'until',
'display_members')
class TypeFilter(admin.SimpleListFilter): class TypeFilter(admin.SimpleListFilter):
......
# Generated by Django 2.1.5 on 2019-02-06 19:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activemembers', '0036_auto_20181024_1939'),
]
operations = [
migrations.AddField(
model_name='membergroup',
name='display_members',
field=models.BooleanField(default=False),
),
]
...@@ -95,6 +95,10 @@ class MemberGroup(models.Model, metaclass=ModelTranslateMeta): ...@@ -95,6 +95,10 @@ class MemberGroup(models.Model, metaclass=ModelTranslateMeta):
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
) )
display_members = models.BooleanField(
default=False,
)
@property @property
def contact_address(self): def contact_address(self):
if self.contact_mailinglist: if self.contact_mailinglist:
......
...@@ -34,22 +34,24 @@ ...@@ -34,22 +34,24 @@
</section> </section>
{% endif %} {% endif %}
<section id="activemembers-membergroup-members" class="page-section"> {% if membergroup.display_members %}
<div class="container"> <section id="activemembers-membergroup-members" class="page-section">
<h1 class="text-center section-title"> <div class="container">
{% trans 'Members' %} <h1 class="text-center section-title">
</h1> {% trans 'Members' %}
</h1>
<div class="row"> <div class="row">
{% for member in members %} {% for member in members %}
<div class="col-4 col-md-3 my-3"> <div class="col-4 col-md-3 my-3">
{% membergroup_member_card member %} {% membergroup_member_card member %}
</div> </div>
{% empty %} {% empty %}
{% trans "This group doesn't have any members?" as empty %} {% trans "This group doesn't have any members?" as empty %}
{% alert 'danger' empty extra_classes='col-10 offset-1' %} {% alert 'danger' empty extra_classes='col-10 offset-1' %}
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</section> </section>
{% endif %}
{% endblock %} {% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment