Commit 1ed4e9dc authored by Luko van der Maas's avatar Luko van der Maas
Browse files

Merge branch 'tc/benefactor-model-value' into 'master'

Replace 'supporter' value in Membership model by 'benefactor'

Closes #712

See merge request !1141
parents 6f91940f f59e7c60
from django.db import migrations
def forwards_func(apps, schema_editor):
Membership = apps.get_model('members', 'membership')
db_alias = schema_editor.connection.alias
Membership.objects.using(db_alias).filter(
type='supporter').update(type='benefactor')
def reverse_func(apps, schema_editor):
Membership = apps.get_model('members', 'membership')
db_alias = schema_editor.connection.alias
Membership.objects.using(db_alias).filter(
type='benefactor').update(type='supporter')
class Migration(migrations.Migration):
dependencies = [
('members', '0029_profile_address_country'),
]
operations = [
migrations.RunPython(forwards_func, reverse_func),
]
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0030_benefactor_model_value'),
]
operations = [
migrations.AlterField(
model_name='membership',
name='type',
field=models.CharField(choices=[('member', 'Member'), ('benefactor', 'Benefactor'), ('honorary', 'Honorary Member')], max_length=40, verbose_name='Membership type'),
),
]
...@@ -524,7 +524,7 @@ class Profile(models.Model): ...@@ -524,7 +524,7 @@ class Profile(models.Model):
class Membership(models.Model): class Membership(models.Model):
MEMBER = 'member' MEMBER = 'member'
BENEFACTOR = 'supporter' BENEFACTOR = 'benefactor'
HONORARY = 'honorary' HONORARY = 'honorary'
MEMBERSHIP_TYPES = ( MEMBERSHIP_TYPES = (
......
...@@ -27,7 +27,7 @@ $(function () { ...@@ -27,7 +27,7 @@ $(function () {
labels: labels:
[ [
gettext('Members'), gettext('Members'),
gettext('Supporters'), gettext('Benefactors'),
gettext('Honorary Members'), gettext('Honorary Members'),
], ],
datasets: [{ datasets: [{
...@@ -39,7 +39,7 @@ $(function () { ...@@ -39,7 +39,7 @@ $(function () {
data: data:
[ [
memberTypeDistribution.member, memberTypeDistribution.member,
memberTypeDistribution.supporter, memberTypeDistribution.benefactor,
memberTypeDistribution.honorary memberTypeDistribution.honorary
], ],
}] }]
...@@ -75,18 +75,18 @@ $(function () { ...@@ -75,18 +75,18 @@ $(function () {
], ],
data: data:
[ [
cohortSizes[0].member + cohortSizes[0].supporter + cohortSizes[0].honorary, cohortSizes[0].member + cohortSizes[0].benefactor + cohortSizes[0].honorary,
cohortSizes[1].member + cohortSizes[1].supporter + cohortSizes[1].honorary, cohortSizes[1].member + cohortSizes[1].benefactor + cohortSizes[1].honorary,
cohortSizes[2].member + cohortSizes[2].supporter + cohortSizes[2].honorary, cohortSizes[2].member + cohortSizes[2].benefactor + cohortSizes[2].honorary,
cohortSizes[3].member + cohortSizes[3].supporter + cohortSizes[3].honorary, cohortSizes[3].member + cohortSizes[3].benefactor + cohortSizes[3].honorary,
cohortSizes[4].member + cohortSizes[4].supporter + cohortSizes[4].honorary, cohortSizes[4].member + cohortSizes[4].benefactor + cohortSizes[4].honorary,
cohortSizes[5].member + cohortSizes[5].supporter + cohortSizes[5].honorary, cohortSizes[5].member + cohortSizes[5].benefactor + cohortSizes[5].honorary,
], ],
}] }]
}, },
options: { options: {
title: { title: {
text: gettext("Total number of (honary) members and supporters per cohort"), text: gettext("Total number of (honary) members and benefactors per cohort"),
}, },
plugins: pluginOptions, plugins: pluginOptions,
} }
...@@ -155,18 +155,18 @@ $(function () { ...@@ -155,18 +155,18 @@ $(function () {
], ],
data: data:
[ [
cohortSizes[0].supporter, cohortSizes[0].benefactor,
cohortSizes[1].supporter, cohortSizes[1].benefactor,
cohortSizes[2].supporter, cohortSizes[2].benefactor,
cohortSizes[3].supporter, cohortSizes[3].benefactor,
cohortSizes[4].supporter, cohortSizes[4].benefactor,
cohortSizes[5].supporter, cohortSizes[5].benefactor,
], ],
}] }]
}, },
options: { options: {
title: { title: {
text: gettext("Supporters per cohort"), text: gettext("Benefactors per cohort"),
}, },
plugins: pluginOptions, plugins: pluginOptions,
} }
......
from django.db import migrations
def forwards_func(apps, schema_editor):
Entry = apps.get_model('registrations', 'entry')
db_alias = schema_editor.connection.alias
Entry.objects.using(db_alias).filter(
membership_type='supporter').update(membership_type='benefactor')
def reverse_func(apps, schema_editor):
Entry = apps.get_model('registrations', 'entry')
db_alias = schema_editor.connection.alias
Entry.objects.using(db_alias).filter(
membership_type='benefactor').update(membership_type='supporter')
class Migration(migrations.Migration):
dependencies = [
('registrations', '0016_registration_address_country'),
]
operations = [
migrations.RunPython(forwards_func, reverse_func),
]
# Generated by Django 2.1.5 on 2019-01-25 15:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registrations', '0017_benefactor_model_value'),
]
operations = [
migrations.AlterField(
model_name='entry',
name='membership_type',
field=models.CharField(choices=[('member', 'Member'), ('benefactor', 'Benefactor')], default='member', max_length=40, verbose_name='membership type'),
),
]
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
have to renew your membership. have to renew your membership.
{% endblocktrans %} {% endblocktrans %}
</p> </p>
{% elif latest_membership.type == 'supporter' and not was_member %} {% elif latest_membership.type == 'benefactor' and not was_member %}
<p class="text-center"> <p class="text-center">
{% blocktrans trimmed %} {% blocktrans trimmed %}
You're a benefactor. Contact the board to renew your You're a benefactor. Contact the board to renew your
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
class="col-lg-6 offset-lg-3"> class="col-lg-6 offset-lg-3">
{% csrf_token %} {% csrf_token %}
{% if not latest_membership.type == 'supporter' %} {% if not latest_membership.type == 'benefactor' %}
{% bootstrap_field form.membership_type %} {% bootstrap_field form.membership_type %}
{% bootstrap_field form.length %} {% bootstrap_field form.length %}
{% else %} {% else %}
......
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