-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dynamically populate signup languages field with known languages (#129)
- Loading branch information
Showing
8 changed files
with
84 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Generated by Django 4.0.7 on 2023-11-24 09:42 | ||
|
||
from django.db import migrations | ||
|
||
languages = [ | ||
"Engels", | ||
"Duits", | ||
"Spaans", | ||
"Frans", | ||
"Italiaans", | ||
"Turks", | ||
"Fries", | ||
"Arabisch", | ||
"Russisch", | ||
"Chinees", | ||
"Grieks", | ||
"Portugees", | ||
"Hongaars", | ||
] | ||
|
||
|
||
def create_default_languages(apps, schema_editor): | ||
Language = apps.get_model("participants", "Language") | ||
for lang in languages: | ||
Language.objects.create(name=lang) | ||
|
||
|
||
def undo(apps, schema_editor): | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("participants", "0006_participant_english_contact_participant_save_longer"), | ||
] | ||
|
||
operations = [migrations.RunPython(create_default_languages, undo)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
from rest_framework import serializers | ||
|
||
from .models import Participant | ||
from .models import Participant, Language | ||
|
||
|
||
class ParticipantSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Participant | ||
fields = ['id', 'name'] | ||
fields = ["id", "name"] | ||
|
||
|
||
class LanguageSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Language | ||
fields = ["name"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters