diff --git a/client/src/components/onboarding/OrganisationAddress.vue b/client/src/components/onboarding/OrganisationAddress.vue
index 442b0eb7..c5200b53 100644
--- a/client/src/components/onboarding/OrganisationAddress.vue
+++ b/client/src/components/onboarding/OrganisationAddress.vue
@@ -1,5 +1,5 @@
diff --git a/client/src/components/onboarding/PersonalAddress.vue b/client/src/components/onboarding/PersonalAddress.vue
index 2538daaa..ff280e12 100644
--- a/client/src/components/onboarding/PersonalAddress.vue
+++ b/client/src/components/onboarding/PersonalAddress.vue
@@ -1,5 +1,5 @@
diff --git a/client/src/pages/onboarding/vv/CheckoutAddress.vue b/client/src/pages/onboarding/vv/CheckoutAddress.vue
index c470c7ec..9098403c 100644
--- a/client/src/pages/onboarding/vv/CheckoutAddress.vue
+++ b/client/src/pages/onboarding/vv/CheckoutAddress.vue
@@ -50,20 +50,20 @@ const billingAddressData: Ref = fetchBillingAddress.d
watch(billingAddressData, (newVal) => {
if (newVal) {
address.value = {
- firstName: newVal.first_name,
- lastName: newVal.last_name,
- street: newVal.street,
- streetNumber: newVal.street_number,
- postalCode: newVal.postal_code,
- city: newVal.city,
- country: newVal.country,
+ firstName: newVal.first_name || "",
+ lastName: newVal.last_name || "",
+ street: newVal.street || "",
+ streetNumber: newVal.street_number || "",
+ postalCode: newVal.postal_code || "",
+ city: newVal.city || "",
+ country: newVal.country || "",
};
orgAddress.value = {
- street: newVal.company_street,
- streetNumber: newVal.company_street_number,
- postalCode: newVal.company_postal_code,
- city: newVal.company_city,
- country: newVal.company_country,
+ street: newVal.company_street || "",
+ streetNumber: newVal.company_street_number || "",
+ postalCode: newVal.company_postal_code || "",
+ city: newVal.company_city || "",
+ country: newVal.company_country || "",
};
}
});
diff --git a/server/vbv_lernwelt/api/directory.py b/server/vbv_lernwelt/api/directory.py
new file mode 100644
index 00000000..e69de29b
diff --git a/server/vbv_lernwelt/core/migrations/0003_organisations.py b/server/vbv_lernwelt/core/migrations/0003_organisations.py
index 9a99d4d0..091a8949 100644
--- a/server/vbv_lernwelt/core/migrations/0003_organisations.py
+++ b/server/vbv_lernwelt/core/migrations/0003_organisations.py
@@ -99,12 +99,9 @@ def add_organisations(apps, schema_editor):
def remove_organisations(apps, schema_editor):
Organisation = apps.get_model("core", "Organisation")
- for org_id, org_data in orgs.items():
+ for org_id in orgs.keys():
Organisation.objects.filter(
organisation_id=org_id,
- name_de=org_data["de"],
- name_fr=org_data["fr"],
- name_it=org_data["it"],
).delete()
diff --git a/server/vbv_lernwelt/shop/admin.py b/server/vbv_lernwelt/shop/admin.py
index 9f8ed707..bc71f414 100644
--- a/server/vbv_lernwelt/shop/admin.py
+++ b/server/vbv_lernwelt/shop/admin.py
@@ -1,6 +1,6 @@
from django.contrib import admin
-from vbv_lernwelt.shop.models import CheckoutInformation
+from vbv_lernwelt.shop.models import CheckoutInformation, Country
@admin.action(description="Create invoice for selected checkouts")
@@ -20,3 +20,13 @@ class CheckoutInformationAdmin(admin.ModelAdmin):
"invoice_transmitted_at",
)
actions = [generate_invoice]
+
+
+@admin.register(Country)
+class CountryAdmin(admin.ModelAdmin):
+ list_display = (
+ "country_id",
+ "name_de",
+ "name_fr",
+ "name_it",
+ )
diff --git a/server/vbv_lernwelt/shop/migrations/0003_auto_20231114_2036.py b/server/vbv_lernwelt/shop/migrations/0003_auto_20231114_2036.py
new file mode 100644
index 00000000..d75cf162
--- /dev/null
+++ b/server/vbv_lernwelt/shop/migrations/0003_auto_20231114_2036.py
@@ -0,0 +1,461 @@
+# Generated by Django 3.2.20 on 2023-11-14 19:36
+
+from django.db import migrations, models
+
+countries = {
+ 1: {"de": "Afghanistan", "fr": "Afghanistan", "it": "Afghanistan"},
+ 2: {"de": "Albanien", "fr": "Albanie", "it": "Albania"},
+ 3: {"de": "Algerien", "fr": "Algérie", "it": "Algeria"},
+ 5: {"de": "Andorra", "fr": "Andorra", "it": "Andorra"},
+ 6: {"de": "Angola", "fr": "Angola", "it": "Angola"},
+ 9: {
+ "de": "Antigua und Barbuda",
+ "fr": "Antigua et Barbuda",
+ "it": "Antigua e Barbuda",
+ },
+ 10: {"de": "Argentinien", "fr": "Argentine", "it": "Argentina"},
+ 11: {"de": "Armenien", "fr": "Armenia", "it": "Armenia"},
+ 13: {"de": "Australien", "fr": "Australie", "it": "Australia"},
+ 14: {"de": "Österreich", "fr": "Autriche", "it": "Austria"},
+ 15: {"de": "Aserbaidschan", "fr": "Azerbaïdjan", "it": "Azerbaijan"},
+ 16: {"de": "Bahamas", "fr": "Bahamas", "it": "Bahamas"},
+ 17: {"de": "Bahrain", "fr": "Bahrain", "it": "Bahrain"},
+ 18: {"de": "Bangladesh", "fr": "Bangladesh", "it": "Bangladesh"},
+ 19: {"de": "Barbados", "fr": "Barbados", "it": "Barbados"},
+ 20: {"de": "Belarus", "fr": "Belarus", "it": "Belarus"},
+ 21: {"de": "Belgien", "fr": "Belgique", "it": "Belgio"},
+ 22: {"de": "Belize", "fr": "Belize", "it": "Belize"},
+ 23: {"de": "Benin", "fr": "Benin", "it": "Benin"},
+ 25: {"de": "Bhutan", "fr": "Bhutan", "it": "Bhutan"},
+ 26: {"de": "Bolivien", "fr": "Bolivia", "it": "Bolivia"},
+ 27: {
+ "de": "Bosnien und Herzegowina",
+ "fr": "Bosnia et Herzegowina",
+ "it": "Bosnia e Herzegovina",
+ },
+ 28: {"de": "Botswana", "fr": "Botswana", "it": "Botswana"},
+ 30: {"de": "Brasilien", "fr": "Brésil", "it": "Brasile"},
+ 32: {"de": "Brunei", "fr": "Brunei", "it": "Brunei"},
+ 33: {"de": "Bulgarien", "fr": "Bulgarie", "it": "Bulgaria"},
+ 34: {"de": "Burkina Faso", "fr": "Burkina Faso", "it": "Burkina Faso"},
+ 35: {"de": "Burundi", "fr": "Burundi", "it": "Burundi"},
+ 36: {"de": "Kambodscha", "fr": "Cambodia", "it": "Cambogia"},
+ 37: {"de": "Kamerun", "fr": "Cameroon", "it": "Camerun"},
+ 38: {"de": "Kanada", "fr": "Canada", "it": "Canada"},
+ 39: {"de": "Kap Verde", "fr": "Cap Vert", "it": "Capo Verde"},
+ 41: {
+ "de": "Zentralafrikanische Republik",
+ "fr": "Centrafricaine (République)",
+ "it": "Repubblica Centrafricana",
+ },
+ 42: {"de": "Tschad", "fr": "Tchad", "it": "Ciad"},
+ 43: {"de": "Chile", "fr": "Chile", "it": "Cile"},
+ 44: {"de": "Volksrepublik China", "fr": "Chine (Rép. pop.)", "it": "Cina"},
+ 47: {"de": "Kolumbien", "fr": "Colombia", "it": "Colombia"},
+ 48: {"de": "Komoren", "fr": "Comoros", "it": "Comoros"},
+ 49: {
+ "de": "Kongo, Republik",
+ "fr": "Congo, Republic of the",
+ "it": "Congo, Repubblica del",
+ },
+ 50: {
+ "de": "Kongo, Demokratische Republik",
+ "fr": "Congo, The Democratic Republic of the",
+ "it": "Congo, Repubblica Democratica del",
+ },
+ 51: {"de": "Grenada", "fr": "Grenade", "it": "Grenada"},
+ 52: {"de": "Costa Rica", "fr": "Costa Rica", "it": "Costa Rica"},
+ 53: {"de": "Elfenbeinküste", "fr": "Côte d´Ivoire", "it": "Costa d´Avorio"},
+ 54: {"de": "Kroatien", "fr": "Croatia", "it": "Croazia"},
+ 55: {"de": "Kuba", "fr": "Cuba", "it": "Cuba"},
+ 56: {"de": "Zypern", "fr": "Cyprus", "it": "Cipro"},
+ 57: {
+ "de": "Tschechische Republik",
+ "fr": "Czech Rebublic",
+ "it": "Repubblica Ceca",
+ },
+ 58: {"de": "Dänemark", "fr": "Danemark", "it": "Danimarca"},
+ 59: {"de": "Dschibuti", "fr": "Djibouti", "it": "Gibuti"},
+ 60: {"de": "Dominica", "fr": "Dominique", "it": "Dominica"},
+ 61: {
+ "de": "Dominikanische Republik",
+ "fr": "République Dominicaine",
+ "it": "Repubblica Dominicana",
+ },
+ 62: {"de": "Ost Timor", "fr": "Timor Oriental", "it": "Timor Est"},
+ 63: {"de": "Ecuador", "fr": "Équateur", "it": "Ecuador"},
+ 64: {"de": "Ägypten", "fr": "Égyptien", "it": "Egitto"},
+ 65: {"de": "El Salvador", "fr": "Salvador", "it": "El Salvador"},
+ 66: {
+ "de": "Äquatorialguniea",
+ "fr": "Guinée équatoriale",
+ "it": "Guinea Equatoriale",
+ },
+ 67: {"de": "Eritrea", "fr": "Érythrée", "it": "Eritrea"},
+ 68: {"de": "Estland", "fr": "Estonia", "it": "Estonia"},
+ 69: {"de": "Äthiopien", "fr": "Éthiopie", "it": "Etiopia"},
+ 72: {"de": "Fidschi-Inseln", "fr": "Iles Fidji", "it": "Isole Figi"},
+ 73: {"de": "Finnland", "fr": "Finlande", "it": "Finlandia"},
+ 74: {"de": "Frankreich", "fr": "France", "it": "Francia"},
+ 79: {"de": "Gabun", "fr": "Gabon", "it": "Gabon"},
+ 80: {"de": "Gambia", "fr": "Gambie", "it": "Gambia"},
+ 81: {"de": "Georgien", "fr": "Géorgie", "it": "Georgia"},
+ 82: {"de": "Deutschland", "fr": "Allemagne", "it": "Germania"},
+ 83: {"de": "Ghana", "fr": "Ghana", "it": "Ghana"},
+ 85: {"de": "Griechenland", "fr": "Grèce", "it": "Grecia"},
+ 90: {"de": "Guatemala", "fr": "Guatemala", "it": "Guatemala"},
+ 92: {"de": "Guinea", "fr": "Guinée", "it": "Guinea"},
+ 93: {"de": "Guinea-Bissau", "fr": "Guinée-Bissau", "it": "Guinea-Bissau"},
+ 94: {"de": "Guyana", "fr": "Guyana", "it": "Guyana"},
+ 95: {"de": "Haiti", "fr": "Haïti", "it": "Haiti"},
+ 97: {"de": "Honduras", "fr": "Honduras", "it": "Honduras"},
+ 99: {"de": "Ungarn", "fr": "Hongrie", "it": "Ungheria"},
+ 100: {"de": "Island", "fr": "Icelande", "it": "Islanda"},
+ 101: {"de": "Indien", "fr": "India", "it": "India"},
+ 102: {"de": "Indonesien", "fr": "Indonésie", "it": "Indonesia"},
+ 103: {"de": "Iran", "fr": "Iran", "it": "Iran"},
+ 104: {"de": "Irak", "fr": "Irak", "it": "Iraq"},
+ 105: {"de": "Irland", "fr": "Irlande", "it": "Irlanda"},
+ 107: {"de": "Israel", "fr": "Israël", "it": "Israele"},
+ 108: {"de": "Italien", "fr": "Italie", "it": "Italia"},
+ 109: {"de": "Jamaika", "fr": "Jamaïque", "it": "Giamaica"},
+ 110: {"de": "Japan", "fr": "Japon", "it": "Giappone"},
+ 112: {"de": "Jordanien", "fr": "Jordanie", "it": "Giordania"},
+ 113: {"de": "Kasachstan", "fr": "Kazakstan", "it": "Kazakistan"},
+ 114: {"de": "Kenia", "fr": "Kénia", "it": "Kenia"},
+ 115: {"de": "Kiribati", "fr": "Kiribati", "it": "Kiribati"},
+ 116: {
+ "de": "Korea, Demokratische Volksrepublik",
+ "fr": "Corée du Nord",
+ "it": "Corea, Repubblica Popolare Democratica",
+ },
+ 117: {
+ "de": "Korea, Republik (auch: Südkorea)",
+ "fr": "Corée du Sud",
+ "it": "Corea, Repubblica (anche: Corea del Sud)",
+ },
+ 118: {"de": "Kuwait", "fr": "Koweït", "it": "Kuwait"},
+ 119: {"de": "Kirgisistan", "fr": "Kirgistan", "it": "Kirghizistan"},
+ 120: {"de": "Laos", "fr": "Laos", "it": "Laos"},
+ 121: {"de": "Lettland", "fr": "Lettonie", "it": "Lettonia"},
+ 122: {"de": "Libanon", "fr": "Lebanon", "it": "Libano"},
+ 123: {"de": "Lesotho", "fr": "Lesotho", "it": "Lesotho"},
+ 124: {"de": "Liberia", "fr": "Liberia", "it": "Liberia"},
+ 125: {"de": "Libyen", "fr": "Libye", "it": "Libia"},
+ 126: {"de": "Liechtenstein", "fr": "Liechtenstein", "it": "Liechtenstein"},
+ 127: {"de": "Litauen", "fr": "Lituanie", "it": "Lituania"},
+ 128: {"de": "Luxembourg", "fr": "Luxembourg", "it": "Lussemburgo"},
+ 130: {
+ "de": "Nordmazedonien",
+ "fr": "Macédoine du Nord",
+ "it": "Macedonia del Nord",
+ },
+ 131: {"de": "Madagaskar", "fr": "Madagascar", "it": "Madagascar"},
+ 132: {"de": "Malawi", "fr": "Malawi", "it": "Malawi"},
+ 133: {"de": "Malaysia", "fr": "Malaisie", "it": "Malesia"},
+ 134: {"de": "Malediven", "fr": "Maldives", "it": "Maldive"},
+ 135: {"de": "Mali", "fr": "Mali", "it": "Mali"},
+ 136: {"de": "Malta", "fr": "Malte", "it": "Malta"},
+ 137: {"de": "Marshall Inseln", "fr": "Iles Marshall", "it": "Isole Marshall"},
+ 139: {"de": "Mauretanien", "fr": "Mauritanie", "it": "Mauritania"},
+ 140: {"de": "Mauritius", "fr": "Ile Maurice", "it": "Mauritius"},
+ 142: {"de": "Mexico", "fr": "Mexique", "it": "Messico"},
+ 143: {"de": "Mikronesien", "fr": "Micronésie", "it": "Micronesia"},
+ 144: {"de": "Moldavien", "fr": "Moldavie", "it": "Moldova"},
+ 145: {"de": "Monaco", "fr": "Monaco", "it": "Monaco"},
+ 146: {"de": "Mongolei", "fr": "Mongolie", "it": "Mongolia"},
+ 148: {"de": "Marokko", "fr": "Morocco", "it": "Marocco"},
+ 149: {"de": "Mosambik", "fr": "Mozambique", "it": "Mozambico"},
+ 150: {"de": "Myanmar", "fr": "Myanmar", "it": "Myanmar"},
+ 151: {"de": "Namibia", "fr": "Namibie", "it": "Namibia"},
+ 152: {"de": "Nauru", "fr": "Nauru", "it": "Nauru"},
+ 153: {"de": "Nepal", "fr": "Népal", "it": "Nepal"},
+ 154: {"de": "Niederlande", "fr": "Pays-Bas", "it": "Paesi Bassi"},
+ 157: {"de": "Neuseeland", "fr": "Nouvelle-Zélande", "it": "Nuova Zelanda"},
+ 158: {"de": "Nicaragua", "fr": "Nicaragua", "it": "Nicaragua"},
+ 159: {"de": "Niger", "fr": "Niger", "it": "Niger"},
+ 160: {"de": "Nigeria", "fr": "Nigeria", "it": "Nigeria"},
+ 164: {"de": "Norwegen", "fr": "Norvège", "it": "Norvegia"},
+ 165: {"de": "Oman", "fr": "Oman", "it": "Oman"},
+ 166: {"de": "Pakistan", "fr": "Pakistan", "it": "Pakistan"},
+ 167: {"de": "Palau", "fr": "Palau", "it": "Palau"},
+ 168: {"de": "Panama", "fr": "Panama", "it": "Panama"},
+ 170: {
+ "de": "Papua-Neuguinea",
+ "fr": "Papouasie Nouvelle-Guinée",
+ "it": "Papua Nuova Guinea",
+ },
+ 171: {"de": "Paraguay", "fr": "Paraguay", "it": "Paraguay"},
+ 172: {"de": "Peru", "fr": "Pérou", "it": "Perù"},
+ 173: {"de": "Philippinen", "fr": "Philippines", "it": "Filippine"},
+ 175: {"de": "Polen", "fr": "Pologne", "it": "Polonia"},
+ 176: {"de": "Portugal", "fr": "Portugal", "it": "Portogallo"},
+ 178: {"de": "Katar", "fr": "Qatar", "it": "Qatar"},
+ 180: {"de": "Rumänien", "fr": "Roumanie", "it": "Romania"},
+ 181: {"de": "Russische Föderation", "fr": "Russie", "it": "Russia"},
+ 182: {"de": "Ruanda", "fr": "Ruanda", "it": "Ruanda"},
+ 183: {
+ "de": "Saint Kitts und Nevis",
+ "fr": "Saint-Kitts-et-Nevis",
+ "it": "Saint Kitts e Nevis",
+ },
+ 184: {"de": "St. Lucia", "fr": "Sainte-Lucie", "it": "Santa Lucia"},
+ 185: {
+ "de": "St. Vincent und die Grenadinen",
+ "fr": "Saint-Vincent-et-Les Grenadines",
+ "it": "Saint Vincent e Grenadine",
+ },
+ 186: {"de": "Samoa", "fr": "Samoa", "it": "Samoa"},
+ 187: {"de": "San Marino", "fr": "San Marino", "it": "San Marino"},
+ 188: {
+ "de": "Sao Tome und Principe",
+ "fr": "Sao Tomé-et-Principe",
+ "it": "São Tomé e Principe",
+ },
+ 189: {"de": "Saudi-Arabien", "fr": "Arabie Saoudite", "it": "Arabia Saudita"},
+ 190: {"de": "Senegal", "fr": "Sénégal", "it": "Senegal"},
+ 191: {"de": "Seychellen", "fr": "Seychelles", "it": "Seychelles"},
+ 192: {"de": "Sierra Leone", "fr": "Sierra Leone", "it": "Sierra Leone"},
+ 193: {"de": "Singapur", "fr": "Singapour", "it": "Singapore"},
+ 194: {"de": "Slowakei", "fr": "Slovaquie", "it": "Slovacchia"},
+ 195: {"de": "Slowenien", "fr": "Slovénie", "it": "Slovenia"},
+ 196: {"de": "Salomonen", "fr": "Iles Salomon", "it": "Salomone"},
+ 197: {"de": "Somalia", "fr": "Somalie", "it": "Somalia"},
+ 198: {"de": "Südafrika", "fr": "Afrique du Sud", "it": "Africa del Sud"},
+ 200: {"de": "Spanien", "fr": "Espagne", "it": "Spagna"},
+ 201: {"de": "Sri Lanka", "fr": "Sri Lanka", "it": "Sri Lanka"},
+ 204: {"de": "Sudan", "fr": "Soudan", "it": "Sudan"},
+ 205: {"de": "Suriname", "fr": "Suriname", "it": "Suriname"},
+ 207: {"de": "Swasiland", "fr": "Swaziland", "it": "Swaziland"},
+ 208: {"de": "Schweden", "fr": "Suède", "it": "Svezia"},
+ 209: {"de": "Schweiz", "fr": "Suisse", "it": "Svizzera"},
+ 210: {"de": "Syrien", "fr": "Syrie", "it": "Siria"},
+ 211: {"de": "Taiwan", "fr": "Taïwan", "it": "Taiwan"},
+ 212: {"de": "Tadschikistan", "fr": "Tadjikistan", "it": "Tagikistan"},
+ 213: {"de": "Tansania", "fr": "Tanzanie", "it": "Tanzania"},
+ 214: {"de": "Thailand", "fr": "Thaïlande", "it": "Tailandia"},
+ 215: {"de": "Togo", "fr": "Togo", "it": "Togo"},
+ 217: {"de": "Tonga", "fr": "Tonga", "it": "Tonga"},
+ 218: {
+ "de": "Trinidad und Tobago",
+ "fr": "Trinité-et-Tobago",
+ "it": "Trinidad e Tobago",
+ },
+ 219: {"de": "Tunesien", "fr": "Tunisie", "it": "Tunisia"},
+ 220: {"de": "Türkei", "fr": "Turchia", "it": "Turchia"},
+ 221: {"de": "Turkmenistan", "fr": "Turkménistan", "it": "Turkmenistan"},
+ 223: {"de": "Tuvalu", "fr": "Tuvalu", "it": "Tuvalu"},
+ 224: {"de": "Uganda", "fr": "Ouganda", "it": "Uganda"},
+ 225: {"de": "Ukraine", "fr": "Ukraine", "it": "Ucraina"},
+ 226: {
+ "de": "Vereinigte Arabische Emirate",
+ "fr": "Émirats Arabes Unis",
+ "it": "Emirati Arabi Uniti",
+ },
+ 227: {"de": "Großbritannien", "fr": "Royaume-Uni", "it": "Regno Unito"},
+ 228: {"de": "USA", "fr": "États-Unis", "it": "Stati Uniti d´ America"},
+ 230: {"de": "Uruguay", "fr": "Uruguay", "it": "Uruguay"},
+ 231: {"de": "Usbekistan", "fr": "Ouzbékistan", "it": "Uzbekistan"},
+ 232: {"de": "Vanuatu", "fr": "Vanuatu", "it": "Vanuatu"},
+ 233: {"de": "Vatikanstadt", "fr": "Vatican", "it": "Città del Vaticano"},
+ 234: {"de": "Venezuela", "fr": "Venezuela", "it": "Venezuela"},
+ 235: {"de": "Vietnam", "fr": "Viêtnam", "it": "Vietnam"},
+ 239: {"de": "Sahara", "fr": "Sahara", "it": "Sahara"},
+ 240: {"de": "Jemen", "fr": "Yémen", "it": "Yemen"},
+ 241: {"de": "Serbien", "fr": "Serbie", "it": "Serbia"},
+ 242: {"de": "Montenegro", "fr": "Monténégro", "it": "Montenegro"},
+ 243: {"de": "Sambia", "fr": "Zambie", "it": "Zambia"},
+ 244: {"de": "Simbabwe", "fr": "Zimbabwe", "it": "Zimbabwe"},
+ 245: {"de": "Hong Kong", "fr": "Hong Kong", "it": "Hong Kong"},
+ 246: {"de": "Falkland Inseln", "fr": "Îles Malouines", "it": "Isole Falkland"},
+ 247: {"de": "Aruba", "fr": "Aruba", "it": "Aruba"},
+ 248: {"de": "Bermuda", "fr": "Bermudes", "it": "Bermuda"},
+ 249: {
+ "de": "Britische Jungferninseln",
+ "fr": "Îles Vierges britanniques",
+ "it": "Isole Vergini britanniche",
+ },
+ 250: {"de": "Curaçao", "fr": "Curaçao", "it": "Curaçao"},
+ 251: {"de": "Anguilla", "fr": "Anguilla", "it": "Anguilla"},
+ 252: {"de": "Montserrat", "fr": "Montserrat", "it": "Montserrat"},
+ 253: {
+ "de": "Bonaire, Sint Eustatius und Saba",
+ "fr": "Bonaire, Saint-Eustache et Saba",
+ "it": "Bonaire, Sint Eustatius e Saba",
+ },
+ 254: {"de": "Cayman Inseln", "fr": "Îles Caïmans", "it": "Isole Cayman"},
+ 255: {"de": "Sint Maarten", "fr": "Saint-Martin", "it": "Sint Maarten"},
+ 256: {
+ "de": "Turks- und Caicos-Inseln",
+ "fr": "Îles Turks et Caïques",
+ "it": "Turks e Caicos",
+ },
+ 257: {"de": "Saint-Barth", "fr": "Saint-Barthélemy", "it": "Saint-Barth"},
+ 258: {
+ "de": "Palästinensisches Gebiet",
+ "fr": "Territoires palestiniens occupés",
+ "it": "Territori palestinesi",
+ },
+ 259: {"de": "Kosovo", "fr": "Kosovo", "it": "Kosovo"},
+ 260: {"de": "Gibraltar", "fr": "Gibraltar", "it": "Gibilterra"},
+ 261: {"de": "Neukaledonien", "fr": "Nouvelle-Calédonie", "it": "Nuova Caledonia"},
+ 262: {
+ "de": "Französisch-Polynesien",
+ "fr": "Polynésie française",
+ "it": "Polinesia francese",
+ },
+ 310: {
+ "de": "Niederländische Antillen",
+ "fr": "Antilles néerlandaises",
+ "it": "Antille olandesi",
+ },
+ 311: {"de": "Antarktika", "fr": "Antarctique", "it": "Antartide"},
+ 312: {
+ "de": "Amerikanisch-Samoa",
+ "fr": "Samoa américaines",
+ "it": "Samoa americane",
+ },
+ 313: {"de": "Åland", "fr": "Åland", "it": "Åland"},
+ 314: {"de": "Bouvetinsel", "fr": "Île Bouvet", "it": "Isola Bouvet"},
+ 315: {"de": "Kokosinseln", "fr": "Îles Cocos", "it": "Isole Cocos (Keeling)"},
+ 316: {"de": "Cookinseln", "fr": "Îles Cook", "it": "Isole Cook"},
+ 317: {
+ "de": "Clipperton-Insel",
+ "fr": "Île de Clipperton",
+ "it": "Isola di Clipperton",
+ },
+ 318: {"de": "Weihnachtsinsel", "fr": "Île Christmas", "it": "Isola di Natale"},
+ 319: {"de": "Färöer-Inseln", "fr": "Îles Féroé", "it": "Isole Färöer"},
+ 320: {
+ "de": "Französisch-Guayana",
+ "fr": "Guyane française",
+ "it": "Guyana francese",
+ },
+ 321: {"de": "Guernsey", "fr": "Guernsey", "it": "Guernsey"},
+ 322: {"de": "Grönland", "fr": "Groenland", "it": "Groenlandia"},
+ 323: {"de": "Guadeloupe", "fr": "Guadeloupe", "it": "Guadalupa"},
+ 324: {
+ "de": "Südgeorgien und die Südlichen Sandwichinseln",
+ "fr": "Géorgie du Sud et Îles Sandwich du Sud",
+ "it": "Georgia del Sud e Sandwich Australi",
+ },
+ 325: {"de": "Guam", "fr": "Guam", "it": "Guam"},
+ 326: {
+ "de": "Heard und McDonaldinseln",
+ "fr": "Îles Heard et McDonald",
+ "it": "Isola Heard e Isole McDonald",
+ },
+ 327: {"de": "Insel Man", "fr": "Île de Man", "it": "Isola di Man"},
+ 328: {
+ "de": "Britisches Territorium im Indischen Ozean",
+ "fr": "Territoire britannique de l´océan Indien",
+ "it": "Territori Britannici dell´Oceano Indiano",
+ },
+ 329: {"de": "Jersey", "fr": "Jersey", "it": "Jersey"},
+ 330: {"de": "Saint-Martin", "fr": "Saint-Martin", "it": "Saint Martin"},
+ 331: {"de": "Macau", "fr": "Macao", "it": "Macao"},
+ 332: {
+ "de": "Nördliche Marianen",
+ "fr": "Îles Mariannes du Nord",
+ "it": "Isole Marianne Settentrionali",
+ },
+ 333: {"de": "Martinique", "fr": "Martinique", "it": "Martinica"},
+ 334: {"de": "Norfolkinsel", "fr": "Île Norfolk", "it": "Isola Norfolk"},
+ 335: {"de": "Niue", "fr": "Niue", "it": "Niue"},
+ 336: {
+ "de": "Saint-Pierre und Miquelon",
+ "fr": "Saint-Pierre-et-Miquelon",
+ "it": "Saint-Pierre e Miquelon",
+ },
+ 337: {"de": "Pitcairninseln", "fr": "Îles Pitcairn", "it": "Isole Pitcairn"},
+ 338: {"de": "Puerto Rico", "fr": "Porto Rico", "it": "Porto Rico"},
+ 339: {"de": "La Réunion", "fr": "La Réunion", "it": "Isola della Riunione"},
+ 340: {
+ "de": "St. Helena, Ascension und Tristan da Cunha",
+ "fr": "Sainte-Hélène, Ascension et Tristan da Cunha",
+ "it": "Sant´Elena, Ascensione e Tristan da Cunha",
+ },
+ 341: {
+ "de": "Spitzbergen, Jan Mayen",
+ "fr": "Spitzberg, Jan Mayen",
+ "it": "Svalbard e Jan Mayen",
+ },
+ 342: {"de": "Südsudan", "fr": "Sud-Soudan", "it": "Sudan del Sud"},
+ 343: {
+ "de": "Französische Süd- und Antarktisgebiete",
+ "fr": "Terres australes et antarctiques françaises",
+ "it": "Territori australi e antartico francese",
+ },
+ 344: {"de": "Tokelau", "fr": "Tokelau", "it": "Tokelau"},
+ 345: {
+ "de": "United States Minor Outlying Islands",
+ "fr": "Îles mineures éloignées des États-Unis",
+ "it": "Isole Minori Esterne degli Stati Uniti",
+ },
+ 346: {
+ "de": "Amerikanische Jungferninseln",
+ "fr": "Îles Vierges américaines",
+ "it": "Isole Vergini Americane",
+ },
+ 347: {"de": "Wallis und Futuna", "fr": "Wallis et Futuna", "it": "Wallis e Futuna"},
+ 348: {"de": "Mayotte", "fr": "Mayotte", "it": "Mayotte"},
+}
+
+
+def add_countries(apps, schema_editor):
+ Country = apps.get_model("shop", "Country")
+
+ for country_id, country_name in countries.items():
+ Country.objects.create(
+ country_id=country_id,
+ name_de=country_name["de"],
+ name_fr=country_name["fr"],
+ name_it=country_name["it"],
+ )
+
+
+def remove_countries(apps, schema_editor):
+ Country = apps.get_model("shop", "Country")
+
+ for country_id in countries.keys():
+ Country.objects.filter(
+ country_id=country_id,
+ ).delete()
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("shop", "0002_auto_20231114_1926"),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name="Country",
+ fields=[
+ ("country_id", models.IntegerField(primary_key=True, serialize=False)),
+ ("name_de", models.CharField(max_length=255)),
+ ("name_fr", models.CharField(max_length=255)),
+ ("name_it", models.CharField(max_length=255)),
+ ],
+ options={
+ "verbose_name": "Country",
+ "verbose_name_plural": "Countries",
+ "ordering": ["country_id"],
+ },
+ ),
+ migrations.RemoveField(
+ model_name="product",
+ name="id",
+ ),
+ migrations.AlterField(
+ model_name="checkoutinformation",
+ name="product_sku",
+ field=models.CharField(max_length=255),
+ ),
+ migrations.AlterField(
+ model_name="product",
+ name="sku",
+ field=models.CharField(max_length=255, primary_key=True, serialize=False),
+ ),
+ migrations.RunPython(add_countries, remove_countries),
+ ]
diff --git a/server/vbv_lernwelt/shop/models.py b/server/vbv_lernwelt/shop/models.py
index 43ed9cfa..eb520ca0 100644
--- a/server/vbv_lernwelt/shop/models.py
+++ b/server/vbv_lernwelt/shop/models.py
@@ -1,6 +1,21 @@
from django.db import models
+class Country(models.Model):
+ country_id = models.IntegerField(primary_key=True)
+ name_de = models.CharField(max_length=255)
+ name_fr = models.CharField(max_length=255)
+ name_it = models.CharField(max_length=255)
+
+ def __str__(self):
+ return f"{self.name_de} ({self.country_id})"
+
+ class Meta:
+ verbose_name = "Country"
+ verbose_name_plural = "Countries"
+ ordering = ["country_id"]
+
+
class BillingAddress(models.Model):
"""
Draft of a billing address for a purchase from the shop.
@@ -26,12 +41,9 @@ class BillingAddress(models.Model):
company_country = models.CharField(max_length=255, blank=True)
-SKUS = [("1", "VV")]
-
-
class Product(models.Model):
+ sku = models.CharField(max_length=255, primary_key=True)
price = models.IntegerField() # 10_00 = 10.00 CHF
- sku = models.CharField(max_length=255, unique=True, choices=SKUS)
name = models.CharField(max_length=255)
description = models.CharField(max_length=255)
@@ -44,7 +56,7 @@ class CheckoutInformation(models.Model):
user = models.ForeignKey("core.User", on_delete=models.PROTECT)
# immutable product information at time of purchase
- product_sku = models.CharField(max_length=255, choices=SKUS)
+ product_sku = models.CharField(max_length=255)
product_price = models.IntegerField() # 10_00 = 10.00 CHF
product_name = models.CharField(max_length=255)
product_description = models.CharField(max_length=255)