Skip to content

Commit

Permalink
Fixing ocladmin orgs membership data reset on api deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Sep 2, 2022
1 parent bb9802c commit 0490b43
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 0 additions & 2 deletions core/fixtures/base_entities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
website: 'openconceptlab.org'
is_staff: true
is_superuser: true
organizations:
- 1
created_at: "2020-06-08T08:00:00+00:00"
updated_at: "2020-06-08T08:00:00+00:00"
created_by: 1
Expand Down
20 changes: 20 additions & 0 deletions core/orgs/migrations/0018_auto_20220902_0517.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.0.6 on 2022-09-02 05:17

from django.db import migrations


def add_org_creator_as_member(apps, schema_editor):
Organization = apps.get_model('orgs', 'Organization')
for org in Organization.objects.all():
org.members.add(org.created_by, org.updated_by)


class Migration(migrations.Migration):

dependencies = [
('orgs', '0017_alter_organization_created_by_and_more'),
]

operations = [
migrations.RunPython(add_org_creator_as_member)
]

0 comments on commit 0490b43

Please sign in to comment.