Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement(Membership): Update choices for membership type #2689

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion users/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def export_csv(modeladmin, request, queryset):
membership_name = {
0: 'Basic', 1: 'Supporting', 2: 'Sponsor', 3: 'Managing',
0: 'Basic', 1: 'Supporting', 2: 'Sponsor',
4: 'Contributing', 5: 'Fellow'
}
response = HttpResponse(content_type='text/csv')
Expand Down
24 changes: 24 additions & 0 deletions users/migrations/0016_auto_20250121_2256.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.17 on 2025-01-21 22:56

# Data migration: Merge MANAGING (3) membership_type into CONTRIBUTING (4)

from django.db import migrations


def update_membership_level(apps, schema_editor):
Membership = apps.get_model('users', 'Membership')
Membership.objects.filter(membership_type=3).update(membership_type=4)


class Migration(migrations.Migration):

dependencies = [
('users', '0015_alter_user_first_name'),
]

operations = [
migrations.RunPython(
update_membership_level,
migrations.RunPython.noop
)
]
18 changes: 18 additions & 0 deletions users/migrations/0017_alter_membership_membership_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.17 on 2025-01-22 03:20

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0016_auto_20250121_2256'),
]

operations = [
migrations.AlterField(
model_name='membership',
name='membership_type',
field=models.IntegerField(choices=[(0, 'Basic Member'), (1, 'Supporting Member'), (2, 'Sponsor Member'), (4, 'Contributing Member'), (5, 'Fellow')], default=0),
),
]
2 changes: 0 additions & 2 deletions users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,13 @@ class Membership(models.Model):
BASIC = 0
SUPPORTING = 1
SPONSOR = 2
MANAGING = 3
CONTRIBUTING = 4
FELLOW = 5

MEMBERSHIP_CHOICES = (
(BASIC, 'Basic Member'),
(SUPPORTING, 'Supporting Member'),
(SPONSOR, 'Sponsor Member'),
(MANAGING, 'Managing Member'),
(CONTRIBUTING, 'Contributing Member'),
(FELLOW, 'Fellow'),
)
Expand Down
Loading