mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-09-15 14:27:39 +02:00
ansible
apps
activity
api
logs
member
api
migrations
0001_initial.py
0002_auto_20200904_2341.py
0003_create_bde_and_kfet.py
0004_replace_null_by_blank.py
0005_remove_null_tag_on_charfields.py
0006_create_note_account_bde_membership.py
0007_auto_20210313_1235.py
0008_auto_20211005_1544.py
0009_auto_20220904_2325.py
0010_new_default_year.py
0011_profile_vss_charter_read.py
__init__.py
static
templates
templatetags
tests
__init__.py
admin.py
apps.py
auth.py
forms.py
hashers.py
models.py
signals.py
tables.py
urls.py
views.py
note
permission
registration
scripts
treasury
wei
docs
locale
note_kfet
.dockerignore
.env_example
.gitignore
.gitlab-ci.yml
.gitmodules
COPYING
Dockerfile
README.md
entrypoint.sh
manage.py
nginx_note.conf_example
note.cron
requirements.txt
tox.ini
uwsgi_note.ini
72 lines
1.8 KiB
Python
72 lines
1.8 KiB
Python
from django.db import migrations
|
|
|
|
|
|
def create_bde_and_kfet(apps, schema_editor):
|
|
"""
|
|
The clubs BDE and Kfet are pre-injected.
|
|
"""
|
|
Club = apps.get_model("member", "club")
|
|
NoteClub = apps.get_model("note", "noteclub")
|
|
Alias = apps.get_model("note", "alias")
|
|
ContentType = apps.get_model('contenttypes', 'ContentType')
|
|
polymorphic_ctype_id = ContentType.objects.get_for_model(NoteClub).id
|
|
|
|
Club.objects.get_or_create(
|
|
id=1,
|
|
name="BDE",
|
|
email="tresorerie.bde@example.com",
|
|
require_memberships=True,
|
|
membership_fee_paid=500,
|
|
membership_fee_unpaid=500,
|
|
membership_duration=396,
|
|
membership_start="2021-08-01",
|
|
membership_end="2022-09-30",
|
|
)
|
|
Club.objects.get_or_create(
|
|
id=2,
|
|
name="Kfet",
|
|
parent_club_id=1,
|
|
email="tresorerie.bde@example.com",
|
|
require_memberships=True,
|
|
membership_fee_paid=3500,
|
|
membership_fee_unpaid=3500,
|
|
membership_duration=396,
|
|
membership_start="2021-08-01",
|
|
membership_end="2022-09-30",
|
|
)
|
|
|
|
NoteClub.objects.get_or_create(
|
|
id=5,
|
|
club_id=1,
|
|
polymorphic_ctype_id=polymorphic_ctype_id,
|
|
)
|
|
NoteClub.objects.get_or_create(
|
|
id=6,
|
|
club_id=2,
|
|
polymorphic_ctype_id=polymorphic_ctype_id,
|
|
)
|
|
|
|
Alias.objects.get_or_create(
|
|
id=5,
|
|
note_id=5,
|
|
name="BDE",
|
|
normalized_name="bde",
|
|
)
|
|
Alias.objects.get_or_create(
|
|
id=6,
|
|
note_id=6,
|
|
name="Kfet",
|
|
normalized_name="kfet",
|
|
)
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('member', '0002_auto_20200904_2341'),
|
|
('note', '0002_create_special_notes'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(create_bde_and_kfet),
|
|
]
|