Verified Commit f59e7c60 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Replace supporter database value by benefactor

parent 068d974b
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):
class Membership(models.Model):
MEMBER = 'member'
BENEFACTOR = 'supporter'
BENEFACTOR = 'benefactor'
HONORARY = 'honorary'
MEMBERSHIP_TYPES = (
......
......@@ -27,7 +27,7 @@ $(function () {
labels:
[
gettext('Members'),
gettext('Supporters'),
gettext('Benefactors'),
gettext('Honorary Members'),
],
datasets: [{
......@@ -39,7 +39,7 @@ $(function () {
data:
[
memberTypeDistribution.member,
memberTypeDistribution.supporter,
memberTypeDistribution.benefactor,
memberTypeDistribution.honorary
],
}]
......@@ -75,18 +75,18 @@ $(function () {
],
data:
[
cohortSizes[0].member + cohortSizes[0].supporter + cohortSizes[0].honorary,
cohortSizes[1].member + cohortSizes[1].supporter + cohortSizes[1].honorary,
cohortSizes[2].member + cohortSizes[2].supporter + cohortSizes[2].honorary,
cohortSizes[3].member + cohortSizes[3].supporter + cohortSizes[3].honorary,
cohortSizes[4].member + cohortSizes[4].supporter + cohortSizes[4].honorary,
cohortSizes[5].member + cohortSizes[5].supporter + cohortSizes[5].honorary,
cohortSizes[0].member + cohortSizes[0].benefactor + cohortSizes[0].honorary,
cohortSizes[1].member + cohortSizes[1].benefactor + cohortSizes[1].honorary,
cohortSizes[2].member + cohortSizes[2].benefactor + cohortSizes[2].honorary,
cohortSizes[3].member + cohortSizes[3].benefactor + cohortSizes[3].honorary,
cohortSizes[4].member + cohortSizes[4].benefactor + cohortSizes[4].honorary,
cohortSizes[5].member + cohortSizes[5].benefactor + cohortSizes[5].honorary,
],
}]
},
options: {
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,
}
......@@ -155,18 +155,18 @@ $(function () {
],
data:
[
cohortSizes[0].supporter,
cohortSizes[1].supporter,
cohortSizes[2].supporter,
cohortSizes[3].supporter,
cohortSizes[4].supporter,
cohortSizes[5].supporter,
cohortSizes[0].benefactor,
cohortSizes[1].benefactor,
cohortSizes[2].benefactor,
cohortSizes[3].benefactor,
cohortSizes[4].benefactor,
cohortSizes[5].benefactor,
],
}]
},
options: {
title: {
text: gettext("Supporters per cohort"),
text: gettext("Benefactors per cohort"),
},
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 @@
have to renew your membership.
{% endblocktrans %}
</p>
{% elif latest_membership.type == 'supporter' and not was_member %}
{% elif latest_membership.type == 'benefactor' and not was_member %}
<p class="text-center">
{% blocktrans trimmed %}
You're a benefactor. Contact the board to renew your
......@@ -135,7 +135,7 @@
class="col-lg-6 offset-lg-3">
{% csrf_token %}
{% if not latest_membership.type == 'supporter' %}
{% if not latest_membership.type == 'benefactor' %}
{% bootstrap_field form.membership_type %}
{% bootstrap_field form.length %}
{% 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