From 94348eb6e0b361969f43c38bfdc21b78ce42959b Mon Sep 17 00:00:00 2001 From: Timo Ludwig Date: Fri, 22 Apr 2022 20:51:46 +0200 Subject: [PATCH 1/5] Allow events to be monthly recurring on mondays --- CHANGELOG.md | 2 ++ integreat_cms/cms/forms/events/recurrence_rule_form.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaa3f5577e..b3bba00ea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ UNRELEASED ---------- +* [ [#1366](https://github.com/digitalfabrik/integreat-cms/issues/1366) ] Fix monthly recurring events on mondays + 2022.4.1 -------- diff --git a/integreat_cms/cms/forms/events/recurrence_rule_form.py b/integreat_cms/cms/forms/events/recurrence_rule_form.py index 359eec2913..beacbd9a67 100644 --- a/integreat_cms/cms/forms/events/recurrence_rule_form.py +++ b/integreat_cms/cms/forms/events/recurrence_rule_form.py @@ -90,7 +90,7 @@ def clean(self): ), ) elif cleaned_data.get("frequency") == frequency.MONTHLY: - if not cleaned_data.get("weekday_for_monthly"): + if cleaned_data.get("weekday_for_monthly") is None: self.add_error( "weekday_for_monthly", forms.ValidationError( From 8856dae52e544082a2ee1c6a51c97e602724a5e5 Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 8 Mar 2022 10:33:17 +0100 Subject: [PATCH 2/5] Add timezone dropdowns to region form --- .../cms/forms/regions/region_form.py | 26 +- .../cms/migrations/0017_region_timezone.py | 634 ++++++++++++++++++ integreat_cms/cms/models/regions/region.py | 30 +- .../cms/templates/regions/region_form.html | 12 + integreat_cms/locale/de/LC_MESSAGES/django.po | 163 ++--- .../src/js/regions/conditional-fields.ts | 29 +- 6 files changed, 809 insertions(+), 85 deletions(-) create mode 100644 integreat_cms/cms/migrations/0017_region_timezone.py diff --git a/integreat_cms/cms/forms/regions/region_form.py b/integreat_cms/cms/forms/regions/region_form.py index 6a1da68a83..61e867d44e 100644 --- a/integreat_cms/cms/forms/regions/region_form.py +++ b/integreat_cms/cms/forms/regions/region_form.py @@ -6,6 +6,7 @@ from django.conf import settings from django.utils.translation import override, ugettext_lazy as _ from django.apps import apps +from zoneinfo import available_timezones from ....gvz_api.utils import GvzRegion from ...models import Region, Page, LanguageTreeNode @@ -15,9 +16,24 @@ from ..icon_widget import IconWidget from ..custom_model_form import CustomModelForm + logger = logging.getLogger(__name__) +def get_timezone_area_choices(): + timezone_regions = list( + {tz.split("/")[0] for tz in available_timezones() if "/" in tz} + ) + timezone_regions.sort() + timezone_regions.remove("Etc") + timezone_regions.remove("SystemV") + return ( + [("", "---------")] + + [(tzr, tzr) for tzr in timezone_regions] + + [("Etc", _("Other timezones"))] + ) + + class RegionForm(CustomModelForm): """ Form for creating and modifying region objects @@ -29,6 +45,12 @@ class RegionForm(CustomModelForm): required=False, ) + timezone_area = forms.ChoiceField( + choices=get_timezone_area_choices, + label=_("Timezone area"), + required=False, + ) + class Meta: """ This class contains additional meta configuration of the form class, see the :class:`django.forms.ModelForm` @@ -62,6 +84,7 @@ class Meta: "short_urls_enabled", "custom_prefix", "tunews_enabled", + "timezone", ] #: The widgets which are used in this form widgets = { @@ -80,7 +103,8 @@ def __init__(self, *args, **kwargs): :type \**kwargs: dict """ super().__init__(*args, **kwargs) - + if self.instance and "/" in self.instance.timezone: + self.fields["timezone_area"].initial = self.instance.timezone.split("/")[0] self.fields["slug"].required = False def save(self, commit=True): diff --git a/integreat_cms/cms/migrations/0017_region_timezone.py b/integreat_cms/cms/migrations/0017_region_timezone.py new file mode 100644 index 0000000000..8bd08f8844 --- /dev/null +++ b/integreat_cms/cms/migrations/0017_region_timezone.py @@ -0,0 +1,634 @@ +# Generated by Django 3.2.12 on 2022-04-20 13:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("cms", "0016_region_tunews_enabled"), + ] + + operations = [ + migrations.AddField( + model_name="region", + name="timezone", + field=models.CharField( + choices=[ + ("", "---------"), + ("Africa/Abidjan", "Abidjan"), + ("Africa/Accra", "Accra"), + ("Africa/Addis_Ababa", "Addis_Ababa"), + ("Africa/Algiers", "Algiers"), + ("Africa/Asmara", "Asmara"), + ("Africa/Asmera", "Asmera"), + ("Africa/Bamako", "Bamako"), + ("Africa/Bangui", "Bangui"), + ("Africa/Banjul", "Banjul"), + ("Africa/Bissau", "Bissau"), + ("Africa/Blantyre", "Blantyre"), + ("Africa/Brazzaville", "Brazzaville"), + ("Africa/Bujumbura", "Bujumbura"), + ("Africa/Cairo", "Cairo"), + ("Africa/Casablanca", "Casablanca"), + ("Africa/Ceuta", "Ceuta"), + ("Africa/Conakry", "Conakry"), + ("Africa/Dakar", "Dakar"), + ("Africa/Dar_es_Salaam", "Dar_es_Salaam"), + ("Africa/Djibouti", "Djibouti"), + ("Africa/Douala", "Douala"), + ("Africa/El_Aaiun", "El_Aaiun"), + ("Africa/Freetown", "Freetown"), + ("Africa/Gaborone", "Gaborone"), + ("Africa/Harare", "Harare"), + ("Africa/Johannesburg", "Johannesburg"), + ("Africa/Juba", "Juba"), + ("Africa/Kampala", "Kampala"), + ("Africa/Khartoum", "Khartoum"), + ("Africa/Kigali", "Kigali"), + ("Africa/Kinshasa", "Kinshasa"), + ("Africa/Lagos", "Lagos"), + ("Africa/Libreville", "Libreville"), + ("Africa/Lome", "Lome"), + ("Africa/Luanda", "Luanda"), + ("Africa/Lubumbashi", "Lubumbashi"), + ("Africa/Lusaka", "Lusaka"), + ("Africa/Malabo", "Malabo"), + ("Africa/Maputo", "Maputo"), + ("Africa/Maseru", "Maseru"), + ("Africa/Mbabane", "Mbabane"), + ("Africa/Mogadishu", "Mogadishu"), + ("Africa/Monrovia", "Monrovia"), + ("Africa/Nairobi", "Nairobi"), + ("Africa/Ndjamena", "Ndjamena"), + ("Africa/Niamey", "Niamey"), + ("Africa/Nouakchott", "Nouakchott"), + ("Africa/Ouagadougou", "Ouagadougou"), + ("Africa/Porto-Novo", "Porto-Novo"), + ("Africa/Sao_Tome", "Sao_Tome"), + ("Africa/Timbuktu", "Timbuktu"), + ("Africa/Tripoli", "Tripoli"), + ("Africa/Tunis", "Tunis"), + ("Africa/Windhoek", "Windhoek"), + ("America/Adak", "Adak"), + ("America/Anchorage", "Anchorage"), + ("America/Anguilla", "Anguilla"), + ("America/Antigua", "Antigua"), + ("America/Araguaina", "Araguaina"), + ("America/Argentina/Buenos_Aires", "Argentina/Buenos_Aires"), + ("America/Argentina/Catamarca", "Argentina/Catamarca"), + ("America/Argentina/ComodRivadavia", "Argentina/ComodRivadavia"), + ("America/Argentina/Cordoba", "Argentina/Cordoba"), + ("America/Argentina/Jujuy", "Argentina/Jujuy"), + ("America/Argentina/La_Rioja", "Argentina/La_Rioja"), + ("America/Argentina/Mendoza", "Argentina/Mendoza"), + ("America/Argentina/Rio_Gallegos", "Argentina/Rio_Gallegos"), + ("America/Argentina/Salta", "Argentina/Salta"), + ("America/Argentina/San_Juan", "Argentina/San_Juan"), + ("America/Argentina/San_Luis", "Argentina/San_Luis"), + ("America/Argentina/Tucuman", "Argentina/Tucuman"), + ("America/Argentina/Ushuaia", "Argentina/Ushuaia"), + ("America/Aruba", "Aruba"), + ("America/Asuncion", "Asuncion"), + ("America/Atikokan", "Atikokan"), + ("America/Atka", "Atka"), + ("America/Bahia", "Bahia"), + ("America/Bahia_Banderas", "Bahia_Banderas"), + ("America/Barbados", "Barbados"), + ("America/Belem", "Belem"), + ("America/Belize", "Belize"), + ("America/Blanc-Sablon", "Blanc-Sablon"), + ("America/Boa_Vista", "Boa_Vista"), + ("America/Bogota", "Bogota"), + ("America/Boise", "Boise"), + ("America/Buenos_Aires", "Buenos_Aires"), + ("America/Cambridge_Bay", "Cambridge_Bay"), + ("America/Campo_Grande", "Campo_Grande"), + ("America/Cancun", "Cancun"), + ("America/Caracas", "Caracas"), + ("America/Catamarca", "Catamarca"), + ("America/Cayenne", "Cayenne"), + ("America/Cayman", "Cayman"), + ("America/Chicago", "Chicago"), + ("America/Chihuahua", "Chihuahua"), + ("America/Coral_Harbour", "Coral_Harbour"), + ("America/Cordoba", "Cordoba"), + ("America/Costa_Rica", "Costa_Rica"), + ("America/Creston", "Creston"), + ("America/Cuiaba", "Cuiaba"), + ("America/Curacao", "Curacao"), + ("America/Danmarkshavn", "Danmarkshavn"), + ("America/Dawson", "Dawson"), + ("America/Dawson_Creek", "Dawson_Creek"), + ("America/Denver", "Denver"), + ("America/Detroit", "Detroit"), + ("America/Dominica", "Dominica"), + ("America/Edmonton", "Edmonton"), + ("America/Eirunepe", "Eirunepe"), + ("America/El_Salvador", "El_Salvador"), + ("America/Ensenada", "Ensenada"), + ("America/Fort_Nelson", "Fort_Nelson"), + ("America/Fort_Wayne", "Fort_Wayne"), + ("America/Fortaleza", "Fortaleza"), + ("America/Glace_Bay", "Glace_Bay"), + ("America/Godthab", "Godthab"), + ("America/Goose_Bay", "Goose_Bay"), + ("America/Grand_Turk", "Grand_Turk"), + ("America/Grenada", "Grenada"), + ("America/Guadeloupe", "Guadeloupe"), + ("America/Guatemala", "Guatemala"), + ("America/Guayaquil", "Guayaquil"), + ("America/Guyana", "Guyana"), + ("America/Halifax", "Halifax"), + ("America/Havana", "Havana"), + ("America/Hermosillo", "Hermosillo"), + ("America/Indiana/Indianapolis", "Indiana/Indianapolis"), + ("America/Indiana/Knox", "Indiana/Knox"), + ("America/Indiana/Marengo", "Indiana/Marengo"), + ("America/Indiana/Petersburg", "Indiana/Petersburg"), + ("America/Indiana/Tell_City", "Indiana/Tell_City"), + ("America/Indiana/Vevay", "Indiana/Vevay"), + ("America/Indiana/Vincennes", "Indiana/Vincennes"), + ("America/Indiana/Winamac", "Indiana/Winamac"), + ("America/Indianapolis", "Indianapolis"), + ("America/Inuvik", "Inuvik"), + ("America/Iqaluit", "Iqaluit"), + ("America/Jamaica", "Jamaica"), + ("America/Jujuy", "Jujuy"), + ("America/Juneau", "Juneau"), + ("America/Kentucky/Louisville", "Kentucky/Louisville"), + ("America/Kentucky/Monticello", "Kentucky/Monticello"), + ("America/Knox_IN", "Knox_IN"), + ("America/Kralendijk", "Kralendijk"), + ("America/La_Paz", "La_Paz"), + ("America/Lima", "Lima"), + ("America/Los_Angeles", "Los_Angeles"), + ("America/Louisville", "Louisville"), + ("America/Lower_Princes", "Lower_Princes"), + ("America/Maceio", "Maceio"), + ("America/Managua", "Managua"), + ("America/Manaus", "Manaus"), + ("America/Marigot", "Marigot"), + ("America/Martinique", "Martinique"), + ("America/Matamoros", "Matamoros"), + ("America/Mazatlan", "Mazatlan"), + ("America/Mendoza", "Mendoza"), + ("America/Menominee", "Menominee"), + ("America/Merida", "Merida"), + ("America/Metlakatla", "Metlakatla"), + ("America/Mexico_City", "Mexico_City"), + ("America/Miquelon", "Miquelon"), + ("America/Moncton", "Moncton"), + ("America/Monterrey", "Monterrey"), + ("America/Montevideo", "Montevideo"), + ("America/Montreal", "Montreal"), + ("America/Montserrat", "Montserrat"), + ("America/Nassau", "Nassau"), + ("America/New_York", "New_York"), + ("America/Nipigon", "Nipigon"), + ("America/Nome", "Nome"), + ("America/Noronha", "Noronha"), + ("America/North_Dakota/Beulah", "North_Dakota/Beulah"), + ("America/North_Dakota/Center", "North_Dakota/Center"), + ("America/North_Dakota/New_Salem", "North_Dakota/New_Salem"), + ("America/Nuuk", "Nuuk"), + ("America/Ojinaga", "Ojinaga"), + ("America/Panama", "Panama"), + ("America/Pangnirtung", "Pangnirtung"), + ("America/Paramaribo", "Paramaribo"), + ("America/Phoenix", "Phoenix"), + ("America/Port-au-Prince", "Port-au-Prince"), + ("America/Port_of_Spain", "Port_of_Spain"), + ("America/Porto_Acre", "Porto_Acre"), + ("America/Porto_Velho", "Porto_Velho"), + ("America/Puerto_Rico", "Puerto_Rico"), + ("America/Punta_Arenas", "Punta_Arenas"), + ("America/Rainy_River", "Rainy_River"), + ("America/Rankin_Inlet", "Rankin_Inlet"), + ("America/Recife", "Recife"), + ("America/Regina", "Regina"), + ("America/Resolute", "Resolute"), + ("America/Rio_Branco", "Rio_Branco"), + ("America/Rosario", "Rosario"), + ("America/Santa_Isabel", "Santa_Isabel"), + ("America/Santarem", "Santarem"), + ("America/Santiago", "Santiago"), + ("America/Santo_Domingo", "Santo_Domingo"), + ("America/Sao_Paulo", "Sao_Paulo"), + ("America/Scoresbysund", "Scoresbysund"), + ("America/Shiprock", "Shiprock"), + ("America/Sitka", "Sitka"), + ("America/St_Barthelemy", "St_Barthelemy"), + ("America/St_Johns", "St_Johns"), + ("America/St_Kitts", "St_Kitts"), + ("America/St_Lucia", "St_Lucia"), + ("America/St_Thomas", "St_Thomas"), + ("America/St_Vincent", "St_Vincent"), + ("America/Swift_Current", "Swift_Current"), + ("America/Tegucigalpa", "Tegucigalpa"), + ("America/Thule", "Thule"), + ("America/Thunder_Bay", "Thunder_Bay"), + ("America/Tijuana", "Tijuana"), + ("America/Toronto", "Toronto"), + ("America/Tortola", "Tortola"), + ("America/Vancouver", "Vancouver"), + ("America/Virgin", "Virgin"), + ("America/Whitehorse", "Whitehorse"), + ("America/Winnipeg", "Winnipeg"), + ("America/Yakutat", "Yakutat"), + ("America/Yellowknife", "Yellowknife"), + ("Antarctica/Casey", "Casey"), + ("Antarctica/Davis", "Davis"), + ("Antarctica/DumontDUrville", "DumontDUrville"), + ("Antarctica/Macquarie", "Macquarie"), + ("Antarctica/Mawson", "Mawson"), + ("Antarctica/McMurdo", "McMurdo"), + ("Antarctica/Palmer", "Palmer"), + ("Antarctica/Rothera", "Rothera"), + ("Antarctica/South_Pole", "South_Pole"), + ("Antarctica/Syowa", "Syowa"), + ("Antarctica/Troll", "Troll"), + ("Antarctica/Vostok", "Vostok"), + ("Arctic/Longyearbyen", "Longyearbyen"), + ("Asia/Aden", "Aden"), + ("Asia/Almaty", "Almaty"), + ("Asia/Amman", "Amman"), + ("Asia/Anadyr", "Anadyr"), + ("Asia/Aqtau", "Aqtau"), + ("Asia/Aqtobe", "Aqtobe"), + ("Asia/Ashgabat", "Ashgabat"), + ("Asia/Ashkhabad", "Ashkhabad"), + ("Asia/Atyrau", "Atyrau"), + ("Asia/Baghdad", "Baghdad"), + ("Asia/Bahrain", "Bahrain"), + ("Asia/Baku", "Baku"), + ("Asia/Bangkok", "Bangkok"), + ("Asia/Barnaul", "Barnaul"), + ("Asia/Beirut", "Beirut"), + ("Asia/Bishkek", "Bishkek"), + ("Asia/Brunei", "Brunei"), + ("Asia/Calcutta", "Calcutta"), + ("Asia/Chita", "Chita"), + ("Asia/Choibalsan", "Choibalsan"), + ("Asia/Chongqing", "Chongqing"), + ("Asia/Chungking", "Chungking"), + ("Asia/Colombo", "Colombo"), + ("Asia/Dacca", "Dacca"), + ("Asia/Damascus", "Damascus"), + ("Asia/Dhaka", "Dhaka"), + ("Asia/Dili", "Dili"), + ("Asia/Dubai", "Dubai"), + ("Asia/Dushanbe", "Dushanbe"), + ("Asia/Famagusta", "Famagusta"), + ("Asia/Gaza", "Gaza"), + ("Asia/Harbin", "Harbin"), + ("Asia/Hebron", "Hebron"), + ("Asia/Ho_Chi_Minh", "Ho_Chi_Minh"), + ("Asia/Hong_Kong", "Hong_Kong"), + ("Asia/Hovd", "Hovd"), + ("Asia/Irkutsk", "Irkutsk"), + ("Asia/Istanbul", "Istanbul"), + ("Asia/Jakarta", "Jakarta"), + ("Asia/Jayapura", "Jayapura"), + ("Asia/Jerusalem", "Jerusalem"), + ("Asia/Kabul", "Kabul"), + ("Asia/Kamchatka", "Kamchatka"), + ("Asia/Karachi", "Karachi"), + ("Asia/Kashgar", "Kashgar"), + ("Asia/Kathmandu", "Kathmandu"), + ("Asia/Katmandu", "Katmandu"), + ("Asia/Khandyga", "Khandyga"), + ("Asia/Kolkata", "Kolkata"), + ("Asia/Krasnoyarsk", "Krasnoyarsk"), + ("Asia/Kuala_Lumpur", "Kuala_Lumpur"), + ("Asia/Kuching", "Kuching"), + ("Asia/Kuwait", "Kuwait"), + ("Asia/Macao", "Macao"), + ("Asia/Macau", "Macau"), + ("Asia/Magadan", "Magadan"), + ("Asia/Makassar", "Makassar"), + ("Asia/Manila", "Manila"), + ("Asia/Muscat", "Muscat"), + ("Asia/Nicosia", "Nicosia"), + ("Asia/Novokuznetsk", "Novokuznetsk"), + ("Asia/Novosibirsk", "Novosibirsk"), + ("Asia/Omsk", "Omsk"), + ("Asia/Oral", "Oral"), + ("Asia/Phnom_Penh", "Phnom_Penh"), + ("Asia/Pontianak", "Pontianak"), + ("Asia/Pyongyang", "Pyongyang"), + ("Asia/Qatar", "Qatar"), + ("Asia/Qostanay", "Qostanay"), + ("Asia/Qyzylorda", "Qyzylorda"), + ("Asia/Rangoon", "Rangoon"), + ("Asia/Riyadh", "Riyadh"), + ("Asia/Saigon", "Saigon"), + ("Asia/Sakhalin", "Sakhalin"), + ("Asia/Samarkand", "Samarkand"), + ("Asia/Seoul", "Seoul"), + ("Asia/Shanghai", "Shanghai"), + ("Asia/Singapore", "Singapore"), + ("Asia/Srednekolymsk", "Srednekolymsk"), + ("Asia/Taipei", "Taipei"), + ("Asia/Tashkent", "Tashkent"), + ("Asia/Tbilisi", "Tbilisi"), + ("Asia/Tehran", "Tehran"), + ("Asia/Tel_Aviv", "Tel_Aviv"), + ("Asia/Thimbu", "Thimbu"), + ("Asia/Thimphu", "Thimphu"), + ("Asia/Tokyo", "Tokyo"), + ("Asia/Tomsk", "Tomsk"), + ("Asia/Ujung_Pandang", "Ujung_Pandang"), + ("Asia/Ulaanbaatar", "Ulaanbaatar"), + ("Asia/Ulan_Bator", "Ulan_Bator"), + ("Asia/Urumqi", "Urumqi"), + ("Asia/Ust-Nera", "Ust-Nera"), + ("Asia/Vientiane", "Vientiane"), + ("Asia/Vladivostok", "Vladivostok"), + ("Asia/Yakutsk", "Yakutsk"), + ("Asia/Yangon", "Yangon"), + ("Asia/Yekaterinburg", "Yekaterinburg"), + ("Asia/Yerevan", "Yerevan"), + ("Atlantic/Azores", "Azores"), + ("Atlantic/Bermuda", "Bermuda"), + ("Atlantic/Canary", "Canary"), + ("Atlantic/Cape_Verde", "Cape_Verde"), + ("Atlantic/Faeroe", "Faeroe"), + ("Atlantic/Faroe", "Faroe"), + ("Atlantic/Jan_Mayen", "Jan_Mayen"), + ("Atlantic/Madeira", "Madeira"), + ("Atlantic/Reykjavik", "Reykjavik"), + ("Atlantic/South_Georgia", "South_Georgia"), + ("Atlantic/St_Helena", "St_Helena"), + ("Atlantic/Stanley", "Stanley"), + ("Australia/ACT", "ACT"), + ("Australia/Adelaide", "Adelaide"), + ("Australia/Brisbane", "Brisbane"), + ("Australia/Broken_Hill", "Broken_Hill"), + ("Australia/Canberra", "Canberra"), + ("Australia/Currie", "Currie"), + ("Australia/Darwin", "Darwin"), + ("Australia/Eucla", "Eucla"), + ("Australia/Hobart", "Hobart"), + ("Australia/LHI", "LHI"), + ("Australia/Lindeman", "Lindeman"), + ("Australia/Lord_Howe", "Lord_Howe"), + ("Australia/Melbourne", "Melbourne"), + ("Australia/NSW", "NSW"), + ("Australia/North", "North"), + ("Australia/Perth", "Perth"), + ("Australia/Queensland", "Queensland"), + ("Australia/South", "South"), + ("Australia/Sydney", "Sydney"), + ("Australia/Tasmania", "Tasmania"), + ("Australia/Victoria", "Victoria"), + ("Australia/West", "West"), + ("Australia/Yancowinna", "Yancowinna"), + ("Brazil/Acre", "Acre"), + ("Brazil/DeNoronha", "DeNoronha"), + ("Brazil/East", "East"), + ("Brazil/West", "West"), + ("CET", "CET"), + ("CST6CDT", "CST6CDT"), + ("Canada/Atlantic", "Atlantic"), + ("Canada/Central", "Central"), + ("Canada/Eastern", "Eastern"), + ("Canada/Mountain", "Mountain"), + ("Canada/Newfoundland", "Newfoundland"), + ("Canada/Pacific", "Pacific"), + ("Canada/Saskatchewan", "Saskatchewan"), + ("Canada/Yukon", "Yukon"), + ("Chile/Continental", "Continental"), + ("Chile/EasterIsland", "EasterIsland"), + ("Cuba", "Cuba"), + ("EET", "EET"), + ("EST", "EST"), + ("EST5EDT", "EST5EDT"), + ("Egypt", "Egypt"), + ("Eire", "Eire"), + ("Etc/GMT", "GMT"), + ("Etc/GMT+0", "GMT+0"), + ("Etc/GMT+1", "GMT+1"), + ("Etc/GMT+10", "GMT+10"), + ("Etc/GMT+11", "GMT+11"), + ("Etc/GMT+12", "GMT+12"), + ("Etc/GMT+2", "GMT+2"), + ("Etc/GMT+3", "GMT+3"), + ("Etc/GMT+4", "GMT+4"), + ("Etc/GMT+5", "GMT+5"), + ("Etc/GMT+6", "GMT+6"), + ("Etc/GMT+7", "GMT+7"), + ("Etc/GMT+8", "GMT+8"), + ("Etc/GMT+9", "GMT+9"), + ("Etc/GMT-0", "GMT-0"), + ("Etc/GMT-1", "GMT-1"), + ("Etc/GMT-10", "GMT-10"), + ("Etc/GMT-11", "GMT-11"), + ("Etc/GMT-12", "GMT-12"), + ("Etc/GMT-13", "GMT-13"), + ("Etc/GMT-14", "GMT-14"), + ("Etc/GMT-2", "GMT-2"), + ("Etc/GMT-3", "GMT-3"), + ("Etc/GMT-4", "GMT-4"), + ("Etc/GMT-5", "GMT-5"), + ("Etc/GMT-6", "GMT-6"), + ("Etc/GMT-7", "GMT-7"), + ("Etc/GMT-8", "GMT-8"), + ("Etc/GMT-9", "GMT-9"), + ("Etc/GMT0", "GMT0"), + ("Etc/Greenwich", "Greenwich"), + ("Etc/UCT", "UCT"), + ("Etc/UTC", "UTC"), + ("Etc/Universal", "Universal"), + ("Etc/Zulu", "Zulu"), + ("Europe/Amsterdam", "Amsterdam"), + ("Europe/Andorra", "Andorra"), + ("Europe/Astrakhan", "Astrakhan"), + ("Europe/Athens", "Athens"), + ("Europe/Belfast", "Belfast"), + ("Europe/Belgrade", "Belgrade"), + ("Europe/Berlin", "Berlin"), + ("Europe/Bratislava", "Bratislava"), + ("Europe/Brussels", "Brussels"), + ("Europe/Bucharest", "Bucharest"), + ("Europe/Budapest", "Budapest"), + ("Europe/Busingen", "Busingen"), + ("Europe/Chisinau", "Chisinau"), + ("Europe/Copenhagen", "Copenhagen"), + ("Europe/Dublin", "Dublin"), + ("Europe/Gibraltar", "Gibraltar"), + ("Europe/Guernsey", "Guernsey"), + ("Europe/Helsinki", "Helsinki"), + ("Europe/Isle_of_Man", "Isle_of_Man"), + ("Europe/Istanbul", "Istanbul"), + ("Europe/Jersey", "Jersey"), + ("Europe/Kaliningrad", "Kaliningrad"), + ("Europe/Kiev", "Kiev"), + ("Europe/Kirov", "Kirov"), + ("Europe/Lisbon", "Lisbon"), + ("Europe/Ljubljana", "Ljubljana"), + ("Europe/London", "London"), + ("Europe/Luxembourg", "Luxembourg"), + ("Europe/Madrid", "Madrid"), + ("Europe/Malta", "Malta"), + ("Europe/Mariehamn", "Mariehamn"), + ("Europe/Minsk", "Minsk"), + ("Europe/Monaco", "Monaco"), + ("Europe/Moscow", "Moscow"), + ("Europe/Nicosia", "Nicosia"), + ("Europe/Oslo", "Oslo"), + ("Europe/Paris", "Paris"), + ("Europe/Podgorica", "Podgorica"), + ("Europe/Prague", "Prague"), + ("Europe/Riga", "Riga"), + ("Europe/Rome", "Rome"), + ("Europe/Samara", "Samara"), + ("Europe/San_Marino", "San_Marino"), + ("Europe/Sarajevo", "Sarajevo"), + ("Europe/Saratov", "Saratov"), + ("Europe/Simferopol", "Simferopol"), + ("Europe/Skopje", "Skopje"), + ("Europe/Sofia", "Sofia"), + ("Europe/Stockholm", "Stockholm"), + ("Europe/Tallinn", "Tallinn"), + ("Europe/Tirane", "Tirane"), + ("Europe/Tiraspol", "Tiraspol"), + ("Europe/Ulyanovsk", "Ulyanovsk"), + ("Europe/Uzhgorod", "Uzhgorod"), + ("Europe/Vaduz", "Vaduz"), + ("Europe/Vatican", "Vatican"), + ("Europe/Vienna", "Vienna"), + ("Europe/Vilnius", "Vilnius"), + ("Europe/Volgograd", "Volgograd"), + ("Europe/Warsaw", "Warsaw"), + ("Europe/Zagreb", "Zagreb"), + ("Europe/Zaporozhye", "Zaporozhye"), + ("Europe/Zurich", "Zurich"), + ("Factory", "Factory"), + ("GB", "GB"), + ("GB-Eire", "GB-Eire"), + ("GMT", "GMT"), + ("GMT+0", "GMT+0"), + ("GMT-0", "GMT-0"), + ("GMT0", "GMT0"), + ("Greenwich", "Greenwich"), + ("HST", "HST"), + ("Hongkong", "Hongkong"), + ("Iceland", "Iceland"), + ("Indian/Antananarivo", "Antananarivo"), + ("Indian/Chagos", "Chagos"), + ("Indian/Christmas", "Christmas"), + ("Indian/Cocos", "Cocos"), + ("Indian/Comoro", "Comoro"), + ("Indian/Kerguelen", "Kerguelen"), + ("Indian/Mahe", "Mahe"), + ("Indian/Maldives", "Maldives"), + ("Indian/Mauritius", "Mauritius"), + ("Indian/Mayotte", "Mayotte"), + ("Indian/Reunion", "Reunion"), + ("Iran", "Iran"), + ("Israel", "Israel"), + ("Jamaica", "Jamaica"), + ("Japan", "Japan"), + ("Kwajalein", "Kwajalein"), + ("Libya", "Libya"), + ("MET", "MET"), + ("MST", "MST"), + ("MST7MDT", "MST7MDT"), + ("Mexico/BajaNorte", "BajaNorte"), + ("Mexico/BajaSur", "BajaSur"), + ("Mexico/General", "General"), + ("NZ", "NZ"), + ("NZ-CHAT", "NZ-CHAT"), + ("Navajo", "Navajo"), + ("PRC", "PRC"), + ("PST8PDT", "PST8PDT"), + ("Pacific/Apia", "Apia"), + ("Pacific/Auckland", "Auckland"), + ("Pacific/Bougainville", "Bougainville"), + ("Pacific/Chatham", "Chatham"), + ("Pacific/Chuuk", "Chuuk"), + ("Pacific/Easter", "Easter"), + ("Pacific/Efate", "Efate"), + ("Pacific/Enderbury", "Enderbury"), + ("Pacific/Fakaofo", "Fakaofo"), + ("Pacific/Fiji", "Fiji"), + ("Pacific/Funafuti", "Funafuti"), + ("Pacific/Galapagos", "Galapagos"), + ("Pacific/Gambier", "Gambier"), + ("Pacific/Guadalcanal", "Guadalcanal"), + ("Pacific/Guam", "Guam"), + ("Pacific/Honolulu", "Honolulu"), + ("Pacific/Johnston", "Johnston"), + ("Pacific/Kanton", "Kanton"), + ("Pacific/Kiritimati", "Kiritimati"), + ("Pacific/Kosrae", "Kosrae"), + ("Pacific/Kwajalein", "Kwajalein"), + ("Pacific/Majuro", "Majuro"), + ("Pacific/Marquesas", "Marquesas"), + ("Pacific/Midway", "Midway"), + ("Pacific/Nauru", "Nauru"), + ("Pacific/Niue", "Niue"), + ("Pacific/Norfolk", "Norfolk"), + ("Pacific/Noumea", "Noumea"), + ("Pacific/Pago_Pago", "Pago_Pago"), + ("Pacific/Palau", "Palau"), + ("Pacific/Pitcairn", "Pitcairn"), + ("Pacific/Pohnpei", "Pohnpei"), + ("Pacific/Ponape", "Ponape"), + ("Pacific/Port_Moresby", "Port_Moresby"), + ("Pacific/Rarotonga", "Rarotonga"), + ("Pacific/Saipan", "Saipan"), + ("Pacific/Samoa", "Samoa"), + ("Pacific/Tahiti", "Tahiti"), + ("Pacific/Tarawa", "Tarawa"), + ("Pacific/Tongatapu", "Tongatapu"), + ("Pacific/Truk", "Truk"), + ("Pacific/Wake", "Wake"), + ("Pacific/Wallis", "Wallis"), + ("Pacific/Yap", "Yap"), + ("Poland", "Poland"), + ("Portugal", "Portugal"), + ("ROC", "ROC"), + ("ROK", "ROK"), + ("Singapore", "Singapore"), + ("SystemV/AST4", "AST4"), + ("SystemV/AST4ADT", "AST4ADT"), + ("SystemV/CST6", "CST6"), + ("SystemV/CST6CDT", "CST6CDT"), + ("SystemV/EST5", "EST5"), + ("SystemV/EST5EDT", "EST5EDT"), + ("SystemV/HST10", "HST10"), + ("SystemV/MST7", "MST7"), + ("SystemV/MST7MDT", "MST7MDT"), + ("SystemV/PST8", "PST8"), + ("SystemV/PST8PDT", "PST8PDT"), + ("SystemV/YST9", "YST9"), + ("SystemV/YST9YDT", "YST9YDT"), + ("Turkey", "Turkey"), + ("UCT", "UCT"), + ("US/Alaska", "Alaska"), + ("US/Aleutian", "Aleutian"), + ("US/Arizona", "Arizona"), + ("US/Central", "Central"), + ("US/East-Indiana", "East-Indiana"), + ("US/Eastern", "Eastern"), + ("US/Hawaii", "Hawaii"), + ("US/Indiana-Starke", "Indiana-Starke"), + ("US/Michigan", "Michigan"), + ("US/Mountain", "Mountain"), + ("US/Pacific", "Pacific"), + ("US/Samoa", "Samoa"), + ("UTC", "UTC"), + ("Universal", "Universal"), + ("W-SU", "W-SU"), + ("WET", "WET"), + ("Zulu", "Zulu"), + ("localtime", "localtime"), + ], + default="Europe/Berlin", + max_length=150, + verbose_name="timezone", + ), + ), + ] diff --git a/integreat_cms/cms/models/regions/region.py b/integreat_cms/cms/models/regions/region.py index 1164ac3886..8686096730 100644 --- a/integreat_cms/cms/models/regions/region.py +++ b/integreat_cms/cms/models/regions/region.py @@ -5,10 +5,13 @@ from django.contrib.auth import get_user_model from django.db import models from django.http import Http404 -from django.utils import timezone +from django.utils import timezone as django_timezone from django.utils.functional import cached_property from django.utils.safestring import mark_safe from django.utils.translation import override, ugettext, ugettext_lazy as _ +from django.conf import settings + +from zoneinfo import available_timezones from ...constants import region_status, administrative_division from ...utils.translation_utils import ugettext_many_lazy as __ @@ -20,6 +23,21 @@ logger = logging.getLogger(__name__) +def get_timezone_choices(): + """ + This method generates the options for the timezone dropdown + + :return: A list of all available timezones + :rtype: list + """ + timezones = list(available_timezones()) + timezones.sort() + + return [("", "---------")] + [ + (tz, tz.split("/", 1)[1] if "/" in tz else tz) for tz in timezones + ] + + # pylint: disable=too-few-public-methods class RegionManager(models.Manager): """ @@ -128,7 +146,6 @@ class Region(AbstractBaseModel): verbose_name=_("activate push notifications"), help_text=_("Whether or not push notifications are enabled in the region"), ) - latitude = models.FloatField( null=True, verbose_name=_("latitude"), @@ -145,8 +162,15 @@ class Region(AbstractBaseModel): verbose_name=_("email address of the administrator"), ) + TIMEZONES = [(tz, tz) for tz in available_timezones()] + timezone = models.CharField( + max_length=150, + choices=get_timezone_choices(), + default=settings.CURRENT_TIME_ZONE, + verbose_name=_("timezone"), + ) created_date = models.DateTimeField( - default=timezone.now, + default=django_timezone.now, verbose_name=_("creation date"), ) last_updated = models.DateTimeField( diff --git a/integreat_cms/cms/templates/regions/region_form.html b/integreat_cms/cms/templates/regions/region_form.html index a9bbd48ccc..5c85932cb2 100644 --- a/integreat_cms/cms/templates/regions/region_form.html +++ b/integreat_cms/cms/templates/regions/region_form.html @@ -99,6 +99,18 @@

{% trans 'Extended Settings' %}

+
+ + + {% render_field form.timezone_area %} +
{{ form.timezone_area.help_text }}
+
+
+ + + {% render_field form.timezone %} +
{{ form.timezone.help_text }}
+
{% render_field form.events_enabled %} diff --git a/integreat_cms/locale/de/LC_MESSAGES/django.po b/integreat_cms/locale/de/LC_MESSAGES/django.po index 5a4293675e..b471cdade7 100644 --- a/integreat_cms/locale/de/LC_MESSAGES/django.po +++ b/integreat_cms/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-15 20:11+0000\n" +"POT-Creation-Date: 2022-04-20 16:40+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Integreat \n" "Language-Team: Integreat \n" @@ -1293,12 +1293,12 @@ msgstr "Einmalig stattfindende Veranstaltungen" msgid "Active" msgstr "Aktiv" -#: cms/constants/region_status.py:17 cms/models/regions/region.py:600 +#: cms/constants/region_status.py:17 cms/models/regions/region.py:624 msgid "Hidden" msgstr "Versteckt" #: cms/constants/region_status.py:18 cms/models/pages/page.py:323 -#: cms/models/regions/region.py:603 cms/templates/events/event_form.html:70 +#: cms/models/regions/region.py:627 cms/templates/events/event_form.html:70 #: cms/templates/pages/page_form.html:93 #: cms/templates/pages/page_tree_archived_node.html:81 #: cms/templates/pois/poi_form.html:60 @@ -1701,37 +1701,45 @@ msgstr "Quell-Region für Live-Inhalte" msgid "Enable write access via API for this page" msgstr "Schreib-Zugriff via API für diese Seite aktivieren" -#: cms/forms/regions/region_form.py:28 +#: cms/forms/regions/region_form.py:33 +msgid "Other timezones" +msgstr "Sonstige Zeitzonen" + +#: cms/forms/regions/region_form.py:44 msgid "Do no import initial content" msgstr "Keine Inhalte übernehmen" -#: cms/forms/regions/region_form.py:132 +#: cms/forms/regions/region_form.py:50 +msgid "Timezone area" +msgstr "Region der Zeitzone" + +#: cms/forms/regions/region_form.py:156 msgid "Statistics can only be enabled when a valid access token is supplied." msgstr "" "Statistiken können nur aktiviert werden, wenn ein gültiges Zugangstoken " "eingegeben wurde." -#: cms/forms/regions/region_form.py:144 +#: cms/forms/regions/region_form.py:168 msgid "The provided access token is invalid." msgstr "Das eingegebene Zugangstoken ist ungültig." -#: cms/forms/regions/region_form.py:227 +#: cms/forms/regions/region_form.py:251 msgid "'{}' is already selected as administrative division." msgstr "'{}' ist bereits als Verwaltungseinheit ausgewählt." -#: cms/forms/regions/region_form.py:232 +#: cms/forms/regions/region_form.py:256 msgid "Please select '{}' as administrative division." msgstr "Bitte wählen Sie '{}' als Verwaltungseinheit." -#: cms/forms/regions/region_form.py:243 +#: cms/forms/regions/region_form.py:267 msgid "Please set {} as default language for this region." msgstr "Bitte setzen Sie '{}' als Standard-Sprache für diese Region." -#: cms/forms/regions/region_form.py:249 +#: cms/forms/regions/region_form.py:273 msgid "Please enable '{}'." msgstr "Bitte aktivieren Sie '{}'." -#: cms/forms/regions/region_form.py:264 +#: cms/forms/regions/region_form.py:288 msgid "" "You cannot include the administrative division into the name and use a " "custom prefix at the same time." @@ -1851,7 +1859,7 @@ msgstr "Die Passwörter stimmen nicht überein." #: cms/models/feedback/feedback.py:60 cms/models/media/directory.py:24 #: cms/models/media/media_file.py:138 #: cms/models/push_notifications/push_notification.py:21 -#: cms/models/regions/region.py:619 +#: cms/models/regions/region.py:643 msgid "region" msgstr "Region" @@ -1860,7 +1868,7 @@ msgstr "Region" #: cms/models/languages/language_tree_node.py:37 #: cms/models/media/directory.py:36 cms/models/offers/offer_template.py:56 #: cms/models/push_notifications/push_notification.py:45 -#: cms/models/regions/region.py:150 cms/models/users/organization.py:34 +#: cms/models/regions/region.py:174 cms/models/users/organization.py:34 #: cms/models/users/user_mfa_key.py:39 msgid "creation date" msgstr "Erstellungsdatum" @@ -1891,7 +1899,7 @@ msgstr "" "generieren." #: cms/models/abstract_content_translation.py:38 -#: cms/models/regions/region.py:89 +#: cms/models/regions/region.py:107 msgid "status" msgstr "Status" @@ -1940,7 +1948,7 @@ msgstr "" #: cms/models/languages/language_tree_node.py:41 #: cms/models/offers/offer_template.py:60 #: cms/models/push_notifications/push_notification_translation.py:37 -#: cms/models/regions/region.py:154 cms/models/users/organization.py:38 +#: cms/models/regions/region.py:178 cms/models/users/organization.py:38 msgid "modification date" msgstr "Änderungsdatum" @@ -2388,7 +2396,7 @@ msgid "language tree nodes" msgstr "Sprach-Knoten" #: cms/models/media/directory.py:17 cms/models/media/media_file.py:123 -#: cms/models/offers/offer_template.py:17 cms/models/regions/region.py:63 +#: cms/models/offers/offer_template.py:17 cms/models/regions/region.py:81 #: cms/models/users/organization.py:14 cms/models/users/role.py:20 msgid "name" msgstr "Name" @@ -2455,7 +2463,7 @@ msgstr "Medien-Dateien" msgid "slug" msgstr "URL-Parameter" -#: cms/models/offers/offer_template.py:25 cms/models/regions/region.py:81 +#: cms/models/offers/offer_template.py:25 cms/models/regions/region.py:99 msgid "Leave blank to generate unique parameter from name" msgstr "" "Dieses Feld freilassen, um einen eindeutigen Alias aus dem Namen zu " @@ -2484,7 +2492,7 @@ msgstr "POST-Parameter" msgid "Additional POST data for retrieving the URL." msgstr "Zusätzliche POST-Daten zum Abrufen der URL." -#: cms/models/offers/offer_template.py:40 cms/models/regions/region.py:106 +#: cms/models/offers/offer_template.py:40 cms/models/regions/region.py:124 msgid "Specify as JSON." msgstr "Als JSON angeben." @@ -2673,7 +2681,7 @@ msgstr "Leer" msgid "street and house number" msgstr "Straße und Hausnummer" -#: cms/models/pois/poi.py:18 cms/models/regions/region.py:142 +#: cms/models/pois/poi.py:18 cms/models/regions/region.py:159 msgid "postal code" msgstr "Postleitzahl" @@ -2685,7 +2693,7 @@ msgstr "Stadt" msgid "country" msgstr "Land" -#: cms/models/pois/poi.py:22 cms/models/regions/region.py:134 +#: cms/models/pois/poi.py:22 cms/models/regions/region.py:151 msgid "latitude" msgstr "Geographische Breite" @@ -2693,7 +2701,7 @@ msgstr "Geographische Breite" msgid "The latitude coordinate" msgstr "Die Breitengrad-Koordinate" -#: cms/models/pois/poi.py:25 cms/models/regions/region.py:139 +#: cms/models/pois/poi.py:25 cms/models/regions/region.py:156 msgid "longitude" msgstr "Geographische Länge" @@ -2780,50 +2788,50 @@ msgstr "Push-Benachrichtigungs-Übersetzung" msgid "push notification translations" msgstr "Push-Benachrichtigungs-Übersetzungen" -#: cms/models/regions/region.py:69 +#: cms/models/regions/region.py:87 msgid "community identification number" msgstr "Amtlicher Gemeindeschlüssel" -#: cms/models/regions/region.py:71 +#: cms/models/regions/region.py:89 msgid "" "Number sequence for identifying politically independent administrative units" msgstr "" "Ziffernfolge zur Identifizierung politisch selbständiger Verwaltungseinheiten" -#: cms/models/regions/region.py:78 +#: cms/models/regions/region.py:96 msgid "URL parameter" msgstr "URL-Parameter" -#: cms/models/regions/region.py:80 cms/models/users/organization.py:20 +#: cms/models/regions/region.py:98 cms/models/users/organization.py:20 msgid "Unique string identifier without spaces and special characters." msgstr "Eindeutiger Bezeichner ohne Leerzeichen und Sonderzeichen." -#: cms/models/regions/region.py:98 +#: cms/models/regions/region.py:116 msgid "administrative division" msgstr "Verwaltungseinheit" -#: cms/models/regions/region.py:102 +#: cms/models/regions/region.py:120 msgid "aliases" msgstr "Aliasnamen" -#: cms/models/regions/region.py:104 +#: cms/models/regions/region.py:122 msgid "E.g. smaller municipalities in that area." msgstr "Z.B. kleinere Gemeinden in der Region." -#: cms/models/regions/region.py:105 +#: cms/models/regions/region.py:123 msgid "If empty, the CMS will try to fill this automatically." msgstr "Wird, wenn leer, automatisch vom CMS befüllt." -#: cms/models/regions/region.py:112 +#: cms/models/regions/region.py:130 msgid "custom prefix" msgstr "Benutzerdefiniertes Präfix" -#: cms/models/regions/region.py:114 +#: cms/models/regions/region.py:132 msgid "Enter parts of the name that should not affect sorting." msgstr "" "Geben Sie Teile des Namens ein, die die Sortierung nicht beeinflussen sollen." -#: cms/models/regions/region.py:116 +#: cms/models/regions/region.py:134 msgid "" "Use this field only if the prefix is not an available choice in the list of " "administrative divisions above." @@ -2831,59 +2839,63 @@ msgstr "" "Verwenden Sie dieses Feld nur, wenn das Präfix in der obigen Liste der " "Verwaltungseinheiten nicht zur Auswahl steht." -#: cms/models/regions/region.py:123 +#: cms/models/regions/region.py:141 msgid "activate events" msgstr "Veranstaltungen aktivieren" -#: cms/models/regions/region.py:124 +#: cms/models/regions/region.py:142 msgid "Whether or not events are enabled in the region" msgstr "Ob Veranstaltungen in der Region aktiviert sind oder nicht" -#: cms/models/regions/region.py:128 +#: cms/models/regions/region.py:146 msgid "activate push notifications" msgstr "Push-Benachrichtigungen aktivieren" -#: cms/models/regions/region.py:129 +#: cms/models/regions/region.py:147 msgid "Whether or not push notifications are enabled in the region" msgstr "Ob Push-Benachrichtigungen in der Region aktiviert sind oder nicht" -#: cms/models/regions/region.py:135 +#: cms/models/regions/region.py:152 msgid "The latitude coordinate of an approximate center of the region" msgstr "Die Breitengrad-Koordinate eines ungefähren Mittelpunkts der Region" -#: cms/models/regions/region.py:140 +#: cms/models/regions/region.py:157 msgid "The longitude coordinate of an approximate center of the region" msgstr "Die Längengrad-Koordinate eines ungefähren Mittelpunkts der Region" -#: cms/models/regions/region.py:145 +#: cms/models/regions/region.py:162 msgid "email address of the administrator" msgstr "E-Mail-Adresse des Administrators" -#: cms/models/regions/region.py:159 +#: cms/models/regions/region.py:170 +msgid "timezone" +msgstr "Zeitzone" + +#: cms/models/regions/region.py:183 msgid "activate statistics" msgstr "Statistiken aktivieren" -#: cms/models/regions/region.py:160 +#: cms/models/regions/region.py:184 msgid "Whether or not statistics are enabled for the region" msgstr "Ob Statistiken für die Region aktiviert sind oder nicht" -#: cms/models/regions/region.py:165 +#: cms/models/regions/region.py:189 msgid "Matomo ID" msgstr "Matomo ID" -#: cms/models/regions/region.py:167 +#: cms/models/regions/region.py:191 msgid "The Matomo ID of this region." msgstr "Die Matomo ID dieser region." -#: cms/models/regions/region.py:168 +#: cms/models/regions/region.py:192 msgid "Will be automatically derived from the Matomo access token." msgstr "Wird automatisch vom Matomo Zugangstoken abgeleitet." -#: cms/models/regions/region.py:175 +#: cms/models/regions/region.py:199 msgid "Matomo authentication token" msgstr "Matomo Authentifizierungs-Token" -#: cms/models/regions/region.py:177 +#: cms/models/regions/region.py:201 msgid "" "The secret Matomo access token of the region is used to authenticate in API " "requests" @@ -2891,11 +2903,11 @@ msgstr "" "Das geheime Matomo-Zugangs-Token der Region wird zur Authentifizierung bei " "API-Anfragen verwendet" -#: cms/models/regions/region.py:183 +#: cms/models/regions/region.py:207 msgid "activate page-specific permissions" msgstr "Seiten-spezifische-Berechtigungen aktivieren" -#: cms/models/regions/region.py:185 +#: cms/models/regions/region.py:209 msgid "" "This allows individual users to be granted the right to edit or publish a " "specific page." @@ -2903,26 +2915,26 @@ msgstr "" "Damit kann einzelnen Benutzern das Recht zum Bearbeiten oder Veröffentlichen " "einer bestimmten Seite eingeräumt werden." -#: cms/models/regions/region.py:191 cms/models/users/organization.py:25 +#: cms/models/regions/region.py:215 cms/models/users/organization.py:25 msgid "logo" msgstr "Logo" -#: cms/models/regions/region.py:200 +#: cms/models/regions/region.py:224 msgid "activate author chat" msgstr "Autoren-Chat aktivieren" -#: cms/models/regions/region.py:202 +#: cms/models/regions/region.py:226 msgid "" "This gives all users of this region access to the cross-regional author chat." msgstr "" "Dies gewährt allen Benutzern dieser Region Zugang zum überregionalen Autoren-" "Chat." -#: cms/models/regions/region.py:208 +#: cms/models/regions/region.py:232 msgid "include administrative division into name" msgstr "Verwaltungseinheit dem Namen hinzufügen" -#: cms/models/regions/region.py:211 +#: cms/models/regions/region.py:235 msgid "" "Determines whether the administrative division is displayed next to the " "region name." @@ -2930,7 +2942,7 @@ msgstr "" "Legt fest, ob die Verwaltungseinheit neben dem Namen der Region angezeigt " "wird." -#: cms/models/regions/region.py:214 +#: cms/models/regions/region.py:238 msgid "" "Sorting is always based on the name, independently from the administrative " "division." @@ -2938,11 +2950,11 @@ msgstr "" "Sortierungen werden immer auf Grundlage der Namen vorgenommen, unabhängig " "von der Verwaltungseinheit." -#: cms/models/regions/region.py:223 +#: cms/models/regions/region.py:247 msgid "offers" msgstr "Angebote" -#: cms/models/regions/region.py:226 +#: cms/models/regions/region.py:250 msgid "" "Integreat offers are extended features apart from pages and events and are " "usually offered by a third party." @@ -2950,7 +2962,7 @@ msgstr "" "Integreat Angebote sind erweiterte Funktionen jenseits von Seiten und " "Ereignissen und werden in der Regel von Drittanbietern bereitgestellt." -#: cms/models/regions/region.py:229 +#: cms/models/regions/region.py:253 msgid "" "In most cases, the url is an external API endpoint which the frontend apps " "can query and render the results inside the Integreat app." @@ -2959,23 +2971,23 @@ msgstr "" "Frontend Anfragen gesendet werden, um die Ergebnisse in der Integreat App " "einzubetten." -#: cms/models/regions/region.py:236 +#: cms/models/regions/region.py:260 msgid "Activate short urls" msgstr "Kurz-URLs aktivieren" -#: cms/models/regions/region.py:237 +#: cms/models/regions/region.py:261 msgid "Please check the box if you want to use short urls." msgstr "Kreuzen Sie an, wenn Sie Kurz-URLs benutzen wollen." -#: cms/models/regions/region.py:242 +#: cms/models/regions/region.py:266 msgid "Enable tunews" msgstr "tünews aktivieren" -#: cms/models/regions/region.py:243 +#: cms/models/regions/region.py:267 msgid "Enable to show a feed of tunews articles to users." msgstr "Auswählen, um Benutzern einen tünews-Feed anzuzeigen." -#: cms/models/regions/region.py:621 cms/models/users/user.py:56 +#: cms/models/regions/region.py:645 cms/models/users/user.py:56 msgid "regions" msgstr "Regionen" @@ -3123,7 +3135,7 @@ msgstr "Mein Dashboard" msgid "Analytics" msgstr "Analyse" -#: cms/templates/_base.html:118 cms/templates/regions/region_form.html:128 +#: cms/templates/_base.html:118 cms/templates/regions/region_form.html:140 #: cms/templates/statistics/_statistics_widget.html:11 #: cms/templates/statistics/statistics_overview.html:10 #: cms/templates/statistics/statistics_overview.html:49 @@ -5209,38 +5221,38 @@ msgstr "Neue Region erstellen" msgid "Center of the region" msgstr "Mittelpunkt der Region" -#: cms/templates/regions/region_form.html:165 +#: cms/templates/regions/region_form.html:177 msgid "Duplicate content of another region" msgstr "Inhalte aus einer anderen Region duplizieren" -#: cms/templates/regions/region_form.html:168 +#: cms/templates/regions/region_form.html:180 msgid "Copy languages, pages and media from another region" msgstr "Sprachen, Seiten und Medien aus einer anderen Region kopieren" -#: cms/templates/regions/region_form.html:177 +#: cms/templates/regions/region_form.html:189 msgid "Delete region" msgstr "Region löschen" -#: cms/templates/regions/region_form.html:178 +#: cms/templates/regions/region_form.html:190 msgid "Please confirm that you really want to delete this region." msgstr "Bitte bestätigen Sie, dass diese Region gelöscht werden soll" -#: cms/templates/regions/region_form.html:179 +#: cms/templates/regions/region_form.html:191 msgid "This can not be reversed." msgstr "Dies kann nicht rückgängig gemacht werden." -#: cms/templates/regions/region_form.html:179 +#: cms/templates/regions/region_form.html:191 msgid "All pages, events and locations of this region will also be deleted." msgstr "" "Alle Seiten, Veranstaltungen und Orte dieser Region werden ebenfalls " "gelöscht." -#: cms/templates/regions/region_form.html:179 +#: cms/templates/regions/region_form.html:191 msgid "Users, who only have access to this region, will be removed as well." msgstr "" "Benutzer, die nur Zugriff auf diese Region besitzen, werden auch entfernt." -#: cms/templates/regions/region_form.html:183 +#: cms/templates/regions/region_form.html:195 msgid "Delete this region" msgstr "Diese Region löschen" @@ -7637,12 +7649,6 @@ msgstr "" #~ msgid "Time" #~ msgstr "Uhrzeit" -#~ msgid "timezone" -#~ msgstr "Zeitzone" - -#~ msgid "Timezone" -#~ msgstr "Zeitzone" - #~ msgid "Bulk actions" #~ msgstr "Mehrfachaktionen" @@ -7966,9 +7972,6 @@ msgstr "" #~ msgid "Activate permissions for specific pages" #~ msgstr "Zusätzliche Berechtigungen für bestimmte Seiten aktivieren" -#~ msgid "Other settings" -#~ msgstr "Andere Einstellungen" - #~ msgid "First child of" #~ msgstr "Erstes Unterelement von" diff --git a/integreat_cms/static/src/js/regions/conditional-fields.ts b/integreat_cms/static/src/js/regions/conditional-fields.ts index 2d0f9d7e24..07120bdbe3 100644 --- a/integreat_cms/static/src/js/regions/conditional-fields.ts +++ b/integreat_cms/static/src/js/regions/conditional-fields.ts @@ -28,4 +28,31 @@ window.addEventListener('load', () => { } }); } -}); \ No newline at end of file + // add conditional logic to display options within the second timezone dropdown + const timezoneAreaDropdown = document.getElementById("id_timezone_area") as HTMLSelectElement; + const timezoneDropdown = document.getElementById("id_timezone") as HTMLSelectElement; + + if(timezoneDropdown && timezoneAreaDropdown) { + updateTimezoneAreaDropdown(); + timezoneAreaDropdown.addEventListener('change', updateTimezoneAreaDropdown) + } +}); + +function updateTimezoneAreaDropdown() { + const timezoneAreaDropdown = document.getElementById("id_timezone_area") as HTMLSelectElement; + const timezoneDropdown = document.getElementById("id_timezone") as HTMLSelectElement; + let otherOptions; + let selectedOptions; + timezoneDropdown.value = ''; + if (timezoneAreaDropdown.value === '') { + selectedOptions = []; + otherOptions = timezoneDropdown.querySelectorAll('option'); + } else { + otherOptions = timezoneDropdown.querySelectorAll('option:not([value*="' + timezoneAreaDropdown.value + '"])'); + selectedOptions = timezoneDropdown.querySelectorAll('option[value*="' + timezoneAreaDropdown.value + '"]'); + } + otherOptions.forEach((option) => option.classList.add('hidden')); + selectedOptions.forEach((option) => option.classList.remove('hidden')); + + timezoneDropdown.querySelector('option[value=""]').classList.remove('hidden'); +} \ No newline at end of file From 1162a0cb9162b0e598bb695b2268e5bad5f22b50 Mon Sep 17 00:00:00 2001 From: Johannes Date: Thu, 21 Apr 2022 17:33:54 +0200 Subject: [PATCH 3/5] Activate region timezone in middleware --- CHANGELOG.md | 1 + .../cms/forms/regions/region_form.py | 33 +- integreat_cms/cms/middleware/__init__.py | 1 - .../cms/migrations/0017_region_timezone.py | 621 +----------------- integreat_cms/cms/models/regions/region.py | 18 - .../cms/templates/regions/region_form.html | 3 - integreat_cms/core/middleware/__init__.py | 1 + .../middleware/timezone_middleware.py | 5 +- integreat_cms/core/settings.py | 2 +- integreat_cms/locale/de/LC_MESSAGES/django.po | 148 ++--- .../src/js/regions/conditional-fields.ts | 28 +- tests/cms/test_duplicate_regions.py | 1 + tests/cms/views/view_config.py | 1 + 13 files changed, 130 insertions(+), 733 deletions(-) delete mode 100644 integreat_cms/cms/middleware/__init__.py rename integreat_cms/{cms => core}/middleware/timezone_middleware.py (85%) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3bba00ea2..ec271100b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ UNRELEASED ---------- * [ [#1366](https://github.com/digitalfabrik/integreat-cms/issues/1366) ] Fix monthly recurring events on mondays +* [ [#1365](https://github.com/digitalfabrik/integreat-cms/issues/1365) ] Add timezone setting to region model 2022.4.1 diff --git a/integreat_cms/cms/forms/regions/region_form.py b/integreat_cms/cms/forms/regions/region_form.py index 61e867d44e..984034f9f3 100644 --- a/integreat_cms/cms/forms/regions/region_form.py +++ b/integreat_cms/cms/forms/regions/region_form.py @@ -2,11 +2,11 @@ from copy import deepcopy +from zoneinfo import available_timezones from django import forms from django.conf import settings from django.utils.translation import override, ugettext_lazy as _ from django.apps import apps -from zoneinfo import available_timezones from ....gvz_api.utils import GvzRegion from ...models import Region, Page, LanguageTreeNode @@ -20,13 +20,37 @@ logger = logging.getLogger(__name__) +def get_timezone_choices(): + """ + This method generates the options for the second timezone dropdown + + :return: A list of all available timezones + :rtype: list + """ + timezones = list(available_timezones()) + timezones.sort() + return [("", "---------")] + [ + (tz, tz.split("/", 1)[1].replace("_", " ")) for tz in timezones if "/" in tz + ] + + def get_timezone_area_choices(): + """ + This method generates the options for the first timezone dropdown. + It displays the general area of a country or city. Often the continent. + + :return: A list of the general areas of the timezones + :rtype: list + + """ timezone_regions = list( - {tz.split("/")[0] for tz in available_timezones() if "/" in tz} + { + tz.split("/")[0] + for tz in available_timezones() + if "/" in tz and "Etc" not in tz and "SystemV" not in tz + } ) timezone_regions.sort() - timezone_regions.remove("Etc") - timezone_regions.remove("SystemV") return ( [("", "---------")] + [(tzr, tzr) for tzr in timezone_regions] @@ -88,6 +112,7 @@ class Meta: ] #: The widgets which are used in this form widgets = { + "timezone": forms.Select(choices=get_timezone_choices()), "icon": IconWidget(), "offers": forms.CheckboxSelectMultiple(), } diff --git a/integreat_cms/cms/middleware/__init__.py b/integreat_cms/cms/middleware/__init__.py deleted file mode 100644 index 189e0a473f..0000000000 --- a/integreat_cms/cms/middleware/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .timezone_middleware import TimezoneMiddleware diff --git a/integreat_cms/cms/migrations/0017_region_timezone.py b/integreat_cms/cms/migrations/0017_region_timezone.py index 8bd08f8844..2f21c15864 100644 --- a/integreat_cms/cms/migrations/0017_region_timezone.py +++ b/integreat_cms/cms/migrations/0017_region_timezone.py @@ -1,9 +1,12 @@ -# Generated by Django 3.2.12 on 2022-04-20 13:38 +# Generated by Django 3.2.12 on 2022-04-23 12:26 from django.db import migrations, models class Migration(migrations.Migration): + """ + This is the migration file for the timezones + """ dependencies = [ ("cms", "0016_region_tunews_enabled"), @@ -14,621 +17,7 @@ class Migration(migrations.Migration): model_name="region", name="timezone", field=models.CharField( - choices=[ - ("", "---------"), - ("Africa/Abidjan", "Abidjan"), - ("Africa/Accra", "Accra"), - ("Africa/Addis_Ababa", "Addis_Ababa"), - ("Africa/Algiers", "Algiers"), - ("Africa/Asmara", "Asmara"), - ("Africa/Asmera", "Asmera"), - ("Africa/Bamako", "Bamako"), - ("Africa/Bangui", "Bangui"), - ("Africa/Banjul", "Banjul"), - ("Africa/Bissau", "Bissau"), - ("Africa/Blantyre", "Blantyre"), - ("Africa/Brazzaville", "Brazzaville"), - ("Africa/Bujumbura", "Bujumbura"), - ("Africa/Cairo", "Cairo"), - ("Africa/Casablanca", "Casablanca"), - ("Africa/Ceuta", "Ceuta"), - ("Africa/Conakry", "Conakry"), - ("Africa/Dakar", "Dakar"), - ("Africa/Dar_es_Salaam", "Dar_es_Salaam"), - ("Africa/Djibouti", "Djibouti"), - ("Africa/Douala", "Douala"), - ("Africa/El_Aaiun", "El_Aaiun"), - ("Africa/Freetown", "Freetown"), - ("Africa/Gaborone", "Gaborone"), - ("Africa/Harare", "Harare"), - ("Africa/Johannesburg", "Johannesburg"), - ("Africa/Juba", "Juba"), - ("Africa/Kampala", "Kampala"), - ("Africa/Khartoum", "Khartoum"), - ("Africa/Kigali", "Kigali"), - ("Africa/Kinshasa", "Kinshasa"), - ("Africa/Lagos", "Lagos"), - ("Africa/Libreville", "Libreville"), - ("Africa/Lome", "Lome"), - ("Africa/Luanda", "Luanda"), - ("Africa/Lubumbashi", "Lubumbashi"), - ("Africa/Lusaka", "Lusaka"), - ("Africa/Malabo", "Malabo"), - ("Africa/Maputo", "Maputo"), - ("Africa/Maseru", "Maseru"), - ("Africa/Mbabane", "Mbabane"), - ("Africa/Mogadishu", "Mogadishu"), - ("Africa/Monrovia", "Monrovia"), - ("Africa/Nairobi", "Nairobi"), - ("Africa/Ndjamena", "Ndjamena"), - ("Africa/Niamey", "Niamey"), - ("Africa/Nouakchott", "Nouakchott"), - ("Africa/Ouagadougou", "Ouagadougou"), - ("Africa/Porto-Novo", "Porto-Novo"), - ("Africa/Sao_Tome", "Sao_Tome"), - ("Africa/Timbuktu", "Timbuktu"), - ("Africa/Tripoli", "Tripoli"), - ("Africa/Tunis", "Tunis"), - ("Africa/Windhoek", "Windhoek"), - ("America/Adak", "Adak"), - ("America/Anchorage", "Anchorage"), - ("America/Anguilla", "Anguilla"), - ("America/Antigua", "Antigua"), - ("America/Araguaina", "Araguaina"), - ("America/Argentina/Buenos_Aires", "Argentina/Buenos_Aires"), - ("America/Argentina/Catamarca", "Argentina/Catamarca"), - ("America/Argentina/ComodRivadavia", "Argentina/ComodRivadavia"), - ("America/Argentina/Cordoba", "Argentina/Cordoba"), - ("America/Argentina/Jujuy", "Argentina/Jujuy"), - ("America/Argentina/La_Rioja", "Argentina/La_Rioja"), - ("America/Argentina/Mendoza", "Argentina/Mendoza"), - ("America/Argentina/Rio_Gallegos", "Argentina/Rio_Gallegos"), - ("America/Argentina/Salta", "Argentina/Salta"), - ("America/Argentina/San_Juan", "Argentina/San_Juan"), - ("America/Argentina/San_Luis", "Argentina/San_Luis"), - ("America/Argentina/Tucuman", "Argentina/Tucuman"), - ("America/Argentina/Ushuaia", "Argentina/Ushuaia"), - ("America/Aruba", "Aruba"), - ("America/Asuncion", "Asuncion"), - ("America/Atikokan", "Atikokan"), - ("America/Atka", "Atka"), - ("America/Bahia", "Bahia"), - ("America/Bahia_Banderas", "Bahia_Banderas"), - ("America/Barbados", "Barbados"), - ("America/Belem", "Belem"), - ("America/Belize", "Belize"), - ("America/Blanc-Sablon", "Blanc-Sablon"), - ("America/Boa_Vista", "Boa_Vista"), - ("America/Bogota", "Bogota"), - ("America/Boise", "Boise"), - ("America/Buenos_Aires", "Buenos_Aires"), - ("America/Cambridge_Bay", "Cambridge_Bay"), - ("America/Campo_Grande", "Campo_Grande"), - ("America/Cancun", "Cancun"), - ("America/Caracas", "Caracas"), - ("America/Catamarca", "Catamarca"), - ("America/Cayenne", "Cayenne"), - ("America/Cayman", "Cayman"), - ("America/Chicago", "Chicago"), - ("America/Chihuahua", "Chihuahua"), - ("America/Coral_Harbour", "Coral_Harbour"), - ("America/Cordoba", "Cordoba"), - ("America/Costa_Rica", "Costa_Rica"), - ("America/Creston", "Creston"), - ("America/Cuiaba", "Cuiaba"), - ("America/Curacao", "Curacao"), - ("America/Danmarkshavn", "Danmarkshavn"), - ("America/Dawson", "Dawson"), - ("America/Dawson_Creek", "Dawson_Creek"), - ("America/Denver", "Denver"), - ("America/Detroit", "Detroit"), - ("America/Dominica", "Dominica"), - ("America/Edmonton", "Edmonton"), - ("America/Eirunepe", "Eirunepe"), - ("America/El_Salvador", "El_Salvador"), - ("America/Ensenada", "Ensenada"), - ("America/Fort_Nelson", "Fort_Nelson"), - ("America/Fort_Wayne", "Fort_Wayne"), - ("America/Fortaleza", "Fortaleza"), - ("America/Glace_Bay", "Glace_Bay"), - ("America/Godthab", "Godthab"), - ("America/Goose_Bay", "Goose_Bay"), - ("America/Grand_Turk", "Grand_Turk"), - ("America/Grenada", "Grenada"), - ("America/Guadeloupe", "Guadeloupe"), - ("America/Guatemala", "Guatemala"), - ("America/Guayaquil", "Guayaquil"), - ("America/Guyana", "Guyana"), - ("America/Halifax", "Halifax"), - ("America/Havana", "Havana"), - ("America/Hermosillo", "Hermosillo"), - ("America/Indiana/Indianapolis", "Indiana/Indianapolis"), - ("America/Indiana/Knox", "Indiana/Knox"), - ("America/Indiana/Marengo", "Indiana/Marengo"), - ("America/Indiana/Petersburg", "Indiana/Petersburg"), - ("America/Indiana/Tell_City", "Indiana/Tell_City"), - ("America/Indiana/Vevay", "Indiana/Vevay"), - ("America/Indiana/Vincennes", "Indiana/Vincennes"), - ("America/Indiana/Winamac", "Indiana/Winamac"), - ("America/Indianapolis", "Indianapolis"), - ("America/Inuvik", "Inuvik"), - ("America/Iqaluit", "Iqaluit"), - ("America/Jamaica", "Jamaica"), - ("America/Jujuy", "Jujuy"), - ("America/Juneau", "Juneau"), - ("America/Kentucky/Louisville", "Kentucky/Louisville"), - ("America/Kentucky/Monticello", "Kentucky/Monticello"), - ("America/Knox_IN", "Knox_IN"), - ("America/Kralendijk", "Kralendijk"), - ("America/La_Paz", "La_Paz"), - ("America/Lima", "Lima"), - ("America/Los_Angeles", "Los_Angeles"), - ("America/Louisville", "Louisville"), - ("America/Lower_Princes", "Lower_Princes"), - ("America/Maceio", "Maceio"), - ("America/Managua", "Managua"), - ("America/Manaus", "Manaus"), - ("America/Marigot", "Marigot"), - ("America/Martinique", "Martinique"), - ("America/Matamoros", "Matamoros"), - ("America/Mazatlan", "Mazatlan"), - ("America/Mendoza", "Mendoza"), - ("America/Menominee", "Menominee"), - ("America/Merida", "Merida"), - ("America/Metlakatla", "Metlakatla"), - ("America/Mexico_City", "Mexico_City"), - ("America/Miquelon", "Miquelon"), - ("America/Moncton", "Moncton"), - ("America/Monterrey", "Monterrey"), - ("America/Montevideo", "Montevideo"), - ("America/Montreal", "Montreal"), - ("America/Montserrat", "Montserrat"), - ("America/Nassau", "Nassau"), - ("America/New_York", "New_York"), - ("America/Nipigon", "Nipigon"), - ("America/Nome", "Nome"), - ("America/Noronha", "Noronha"), - ("America/North_Dakota/Beulah", "North_Dakota/Beulah"), - ("America/North_Dakota/Center", "North_Dakota/Center"), - ("America/North_Dakota/New_Salem", "North_Dakota/New_Salem"), - ("America/Nuuk", "Nuuk"), - ("America/Ojinaga", "Ojinaga"), - ("America/Panama", "Panama"), - ("America/Pangnirtung", "Pangnirtung"), - ("America/Paramaribo", "Paramaribo"), - ("America/Phoenix", "Phoenix"), - ("America/Port-au-Prince", "Port-au-Prince"), - ("America/Port_of_Spain", "Port_of_Spain"), - ("America/Porto_Acre", "Porto_Acre"), - ("America/Porto_Velho", "Porto_Velho"), - ("America/Puerto_Rico", "Puerto_Rico"), - ("America/Punta_Arenas", "Punta_Arenas"), - ("America/Rainy_River", "Rainy_River"), - ("America/Rankin_Inlet", "Rankin_Inlet"), - ("America/Recife", "Recife"), - ("America/Regina", "Regina"), - ("America/Resolute", "Resolute"), - ("America/Rio_Branco", "Rio_Branco"), - ("America/Rosario", "Rosario"), - ("America/Santa_Isabel", "Santa_Isabel"), - ("America/Santarem", "Santarem"), - ("America/Santiago", "Santiago"), - ("America/Santo_Domingo", "Santo_Domingo"), - ("America/Sao_Paulo", "Sao_Paulo"), - ("America/Scoresbysund", "Scoresbysund"), - ("America/Shiprock", "Shiprock"), - ("America/Sitka", "Sitka"), - ("America/St_Barthelemy", "St_Barthelemy"), - ("America/St_Johns", "St_Johns"), - ("America/St_Kitts", "St_Kitts"), - ("America/St_Lucia", "St_Lucia"), - ("America/St_Thomas", "St_Thomas"), - ("America/St_Vincent", "St_Vincent"), - ("America/Swift_Current", "Swift_Current"), - ("America/Tegucigalpa", "Tegucigalpa"), - ("America/Thule", "Thule"), - ("America/Thunder_Bay", "Thunder_Bay"), - ("America/Tijuana", "Tijuana"), - ("America/Toronto", "Toronto"), - ("America/Tortola", "Tortola"), - ("America/Vancouver", "Vancouver"), - ("America/Virgin", "Virgin"), - ("America/Whitehorse", "Whitehorse"), - ("America/Winnipeg", "Winnipeg"), - ("America/Yakutat", "Yakutat"), - ("America/Yellowknife", "Yellowknife"), - ("Antarctica/Casey", "Casey"), - ("Antarctica/Davis", "Davis"), - ("Antarctica/DumontDUrville", "DumontDUrville"), - ("Antarctica/Macquarie", "Macquarie"), - ("Antarctica/Mawson", "Mawson"), - ("Antarctica/McMurdo", "McMurdo"), - ("Antarctica/Palmer", "Palmer"), - ("Antarctica/Rothera", "Rothera"), - ("Antarctica/South_Pole", "South_Pole"), - ("Antarctica/Syowa", "Syowa"), - ("Antarctica/Troll", "Troll"), - ("Antarctica/Vostok", "Vostok"), - ("Arctic/Longyearbyen", "Longyearbyen"), - ("Asia/Aden", "Aden"), - ("Asia/Almaty", "Almaty"), - ("Asia/Amman", "Amman"), - ("Asia/Anadyr", "Anadyr"), - ("Asia/Aqtau", "Aqtau"), - ("Asia/Aqtobe", "Aqtobe"), - ("Asia/Ashgabat", "Ashgabat"), - ("Asia/Ashkhabad", "Ashkhabad"), - ("Asia/Atyrau", "Atyrau"), - ("Asia/Baghdad", "Baghdad"), - ("Asia/Bahrain", "Bahrain"), - ("Asia/Baku", "Baku"), - ("Asia/Bangkok", "Bangkok"), - ("Asia/Barnaul", "Barnaul"), - ("Asia/Beirut", "Beirut"), - ("Asia/Bishkek", "Bishkek"), - ("Asia/Brunei", "Brunei"), - ("Asia/Calcutta", "Calcutta"), - ("Asia/Chita", "Chita"), - ("Asia/Choibalsan", "Choibalsan"), - ("Asia/Chongqing", "Chongqing"), - ("Asia/Chungking", "Chungking"), - ("Asia/Colombo", "Colombo"), - ("Asia/Dacca", "Dacca"), - ("Asia/Damascus", "Damascus"), - ("Asia/Dhaka", "Dhaka"), - ("Asia/Dili", "Dili"), - ("Asia/Dubai", "Dubai"), - ("Asia/Dushanbe", "Dushanbe"), - ("Asia/Famagusta", "Famagusta"), - ("Asia/Gaza", "Gaza"), - ("Asia/Harbin", "Harbin"), - ("Asia/Hebron", "Hebron"), - ("Asia/Ho_Chi_Minh", "Ho_Chi_Minh"), - ("Asia/Hong_Kong", "Hong_Kong"), - ("Asia/Hovd", "Hovd"), - ("Asia/Irkutsk", "Irkutsk"), - ("Asia/Istanbul", "Istanbul"), - ("Asia/Jakarta", "Jakarta"), - ("Asia/Jayapura", "Jayapura"), - ("Asia/Jerusalem", "Jerusalem"), - ("Asia/Kabul", "Kabul"), - ("Asia/Kamchatka", "Kamchatka"), - ("Asia/Karachi", "Karachi"), - ("Asia/Kashgar", "Kashgar"), - ("Asia/Kathmandu", "Kathmandu"), - ("Asia/Katmandu", "Katmandu"), - ("Asia/Khandyga", "Khandyga"), - ("Asia/Kolkata", "Kolkata"), - ("Asia/Krasnoyarsk", "Krasnoyarsk"), - ("Asia/Kuala_Lumpur", "Kuala_Lumpur"), - ("Asia/Kuching", "Kuching"), - ("Asia/Kuwait", "Kuwait"), - ("Asia/Macao", "Macao"), - ("Asia/Macau", "Macau"), - ("Asia/Magadan", "Magadan"), - ("Asia/Makassar", "Makassar"), - ("Asia/Manila", "Manila"), - ("Asia/Muscat", "Muscat"), - ("Asia/Nicosia", "Nicosia"), - ("Asia/Novokuznetsk", "Novokuznetsk"), - ("Asia/Novosibirsk", "Novosibirsk"), - ("Asia/Omsk", "Omsk"), - ("Asia/Oral", "Oral"), - ("Asia/Phnom_Penh", "Phnom_Penh"), - ("Asia/Pontianak", "Pontianak"), - ("Asia/Pyongyang", "Pyongyang"), - ("Asia/Qatar", "Qatar"), - ("Asia/Qostanay", "Qostanay"), - ("Asia/Qyzylorda", "Qyzylorda"), - ("Asia/Rangoon", "Rangoon"), - ("Asia/Riyadh", "Riyadh"), - ("Asia/Saigon", "Saigon"), - ("Asia/Sakhalin", "Sakhalin"), - ("Asia/Samarkand", "Samarkand"), - ("Asia/Seoul", "Seoul"), - ("Asia/Shanghai", "Shanghai"), - ("Asia/Singapore", "Singapore"), - ("Asia/Srednekolymsk", "Srednekolymsk"), - ("Asia/Taipei", "Taipei"), - ("Asia/Tashkent", "Tashkent"), - ("Asia/Tbilisi", "Tbilisi"), - ("Asia/Tehran", "Tehran"), - ("Asia/Tel_Aviv", "Tel_Aviv"), - ("Asia/Thimbu", "Thimbu"), - ("Asia/Thimphu", "Thimphu"), - ("Asia/Tokyo", "Tokyo"), - ("Asia/Tomsk", "Tomsk"), - ("Asia/Ujung_Pandang", "Ujung_Pandang"), - ("Asia/Ulaanbaatar", "Ulaanbaatar"), - ("Asia/Ulan_Bator", "Ulan_Bator"), - ("Asia/Urumqi", "Urumqi"), - ("Asia/Ust-Nera", "Ust-Nera"), - ("Asia/Vientiane", "Vientiane"), - ("Asia/Vladivostok", "Vladivostok"), - ("Asia/Yakutsk", "Yakutsk"), - ("Asia/Yangon", "Yangon"), - ("Asia/Yekaterinburg", "Yekaterinburg"), - ("Asia/Yerevan", "Yerevan"), - ("Atlantic/Azores", "Azores"), - ("Atlantic/Bermuda", "Bermuda"), - ("Atlantic/Canary", "Canary"), - ("Atlantic/Cape_Verde", "Cape_Verde"), - ("Atlantic/Faeroe", "Faeroe"), - ("Atlantic/Faroe", "Faroe"), - ("Atlantic/Jan_Mayen", "Jan_Mayen"), - ("Atlantic/Madeira", "Madeira"), - ("Atlantic/Reykjavik", "Reykjavik"), - ("Atlantic/South_Georgia", "South_Georgia"), - ("Atlantic/St_Helena", "St_Helena"), - ("Atlantic/Stanley", "Stanley"), - ("Australia/ACT", "ACT"), - ("Australia/Adelaide", "Adelaide"), - ("Australia/Brisbane", "Brisbane"), - ("Australia/Broken_Hill", "Broken_Hill"), - ("Australia/Canberra", "Canberra"), - ("Australia/Currie", "Currie"), - ("Australia/Darwin", "Darwin"), - ("Australia/Eucla", "Eucla"), - ("Australia/Hobart", "Hobart"), - ("Australia/LHI", "LHI"), - ("Australia/Lindeman", "Lindeman"), - ("Australia/Lord_Howe", "Lord_Howe"), - ("Australia/Melbourne", "Melbourne"), - ("Australia/NSW", "NSW"), - ("Australia/North", "North"), - ("Australia/Perth", "Perth"), - ("Australia/Queensland", "Queensland"), - ("Australia/South", "South"), - ("Australia/Sydney", "Sydney"), - ("Australia/Tasmania", "Tasmania"), - ("Australia/Victoria", "Victoria"), - ("Australia/West", "West"), - ("Australia/Yancowinna", "Yancowinna"), - ("Brazil/Acre", "Acre"), - ("Brazil/DeNoronha", "DeNoronha"), - ("Brazil/East", "East"), - ("Brazil/West", "West"), - ("CET", "CET"), - ("CST6CDT", "CST6CDT"), - ("Canada/Atlantic", "Atlantic"), - ("Canada/Central", "Central"), - ("Canada/Eastern", "Eastern"), - ("Canada/Mountain", "Mountain"), - ("Canada/Newfoundland", "Newfoundland"), - ("Canada/Pacific", "Pacific"), - ("Canada/Saskatchewan", "Saskatchewan"), - ("Canada/Yukon", "Yukon"), - ("Chile/Continental", "Continental"), - ("Chile/EasterIsland", "EasterIsland"), - ("Cuba", "Cuba"), - ("EET", "EET"), - ("EST", "EST"), - ("EST5EDT", "EST5EDT"), - ("Egypt", "Egypt"), - ("Eire", "Eire"), - ("Etc/GMT", "GMT"), - ("Etc/GMT+0", "GMT+0"), - ("Etc/GMT+1", "GMT+1"), - ("Etc/GMT+10", "GMT+10"), - ("Etc/GMT+11", "GMT+11"), - ("Etc/GMT+12", "GMT+12"), - ("Etc/GMT+2", "GMT+2"), - ("Etc/GMT+3", "GMT+3"), - ("Etc/GMT+4", "GMT+4"), - ("Etc/GMT+5", "GMT+5"), - ("Etc/GMT+6", "GMT+6"), - ("Etc/GMT+7", "GMT+7"), - ("Etc/GMT+8", "GMT+8"), - ("Etc/GMT+9", "GMT+9"), - ("Etc/GMT-0", "GMT-0"), - ("Etc/GMT-1", "GMT-1"), - ("Etc/GMT-10", "GMT-10"), - ("Etc/GMT-11", "GMT-11"), - ("Etc/GMT-12", "GMT-12"), - ("Etc/GMT-13", "GMT-13"), - ("Etc/GMT-14", "GMT-14"), - ("Etc/GMT-2", "GMT-2"), - ("Etc/GMT-3", "GMT-3"), - ("Etc/GMT-4", "GMT-4"), - ("Etc/GMT-5", "GMT-5"), - ("Etc/GMT-6", "GMT-6"), - ("Etc/GMT-7", "GMT-7"), - ("Etc/GMT-8", "GMT-8"), - ("Etc/GMT-9", "GMT-9"), - ("Etc/GMT0", "GMT0"), - ("Etc/Greenwich", "Greenwich"), - ("Etc/UCT", "UCT"), - ("Etc/UTC", "UTC"), - ("Etc/Universal", "Universal"), - ("Etc/Zulu", "Zulu"), - ("Europe/Amsterdam", "Amsterdam"), - ("Europe/Andorra", "Andorra"), - ("Europe/Astrakhan", "Astrakhan"), - ("Europe/Athens", "Athens"), - ("Europe/Belfast", "Belfast"), - ("Europe/Belgrade", "Belgrade"), - ("Europe/Berlin", "Berlin"), - ("Europe/Bratislava", "Bratislava"), - ("Europe/Brussels", "Brussels"), - ("Europe/Bucharest", "Bucharest"), - ("Europe/Budapest", "Budapest"), - ("Europe/Busingen", "Busingen"), - ("Europe/Chisinau", "Chisinau"), - ("Europe/Copenhagen", "Copenhagen"), - ("Europe/Dublin", "Dublin"), - ("Europe/Gibraltar", "Gibraltar"), - ("Europe/Guernsey", "Guernsey"), - ("Europe/Helsinki", "Helsinki"), - ("Europe/Isle_of_Man", "Isle_of_Man"), - ("Europe/Istanbul", "Istanbul"), - ("Europe/Jersey", "Jersey"), - ("Europe/Kaliningrad", "Kaliningrad"), - ("Europe/Kiev", "Kiev"), - ("Europe/Kirov", "Kirov"), - ("Europe/Lisbon", "Lisbon"), - ("Europe/Ljubljana", "Ljubljana"), - ("Europe/London", "London"), - ("Europe/Luxembourg", "Luxembourg"), - ("Europe/Madrid", "Madrid"), - ("Europe/Malta", "Malta"), - ("Europe/Mariehamn", "Mariehamn"), - ("Europe/Minsk", "Minsk"), - ("Europe/Monaco", "Monaco"), - ("Europe/Moscow", "Moscow"), - ("Europe/Nicosia", "Nicosia"), - ("Europe/Oslo", "Oslo"), - ("Europe/Paris", "Paris"), - ("Europe/Podgorica", "Podgorica"), - ("Europe/Prague", "Prague"), - ("Europe/Riga", "Riga"), - ("Europe/Rome", "Rome"), - ("Europe/Samara", "Samara"), - ("Europe/San_Marino", "San_Marino"), - ("Europe/Sarajevo", "Sarajevo"), - ("Europe/Saratov", "Saratov"), - ("Europe/Simferopol", "Simferopol"), - ("Europe/Skopje", "Skopje"), - ("Europe/Sofia", "Sofia"), - ("Europe/Stockholm", "Stockholm"), - ("Europe/Tallinn", "Tallinn"), - ("Europe/Tirane", "Tirane"), - ("Europe/Tiraspol", "Tiraspol"), - ("Europe/Ulyanovsk", "Ulyanovsk"), - ("Europe/Uzhgorod", "Uzhgorod"), - ("Europe/Vaduz", "Vaduz"), - ("Europe/Vatican", "Vatican"), - ("Europe/Vienna", "Vienna"), - ("Europe/Vilnius", "Vilnius"), - ("Europe/Volgograd", "Volgograd"), - ("Europe/Warsaw", "Warsaw"), - ("Europe/Zagreb", "Zagreb"), - ("Europe/Zaporozhye", "Zaporozhye"), - ("Europe/Zurich", "Zurich"), - ("Factory", "Factory"), - ("GB", "GB"), - ("GB-Eire", "GB-Eire"), - ("GMT", "GMT"), - ("GMT+0", "GMT+0"), - ("GMT-0", "GMT-0"), - ("GMT0", "GMT0"), - ("Greenwich", "Greenwich"), - ("HST", "HST"), - ("Hongkong", "Hongkong"), - ("Iceland", "Iceland"), - ("Indian/Antananarivo", "Antananarivo"), - ("Indian/Chagos", "Chagos"), - ("Indian/Christmas", "Christmas"), - ("Indian/Cocos", "Cocos"), - ("Indian/Comoro", "Comoro"), - ("Indian/Kerguelen", "Kerguelen"), - ("Indian/Mahe", "Mahe"), - ("Indian/Maldives", "Maldives"), - ("Indian/Mauritius", "Mauritius"), - ("Indian/Mayotte", "Mayotte"), - ("Indian/Reunion", "Reunion"), - ("Iran", "Iran"), - ("Israel", "Israel"), - ("Jamaica", "Jamaica"), - ("Japan", "Japan"), - ("Kwajalein", "Kwajalein"), - ("Libya", "Libya"), - ("MET", "MET"), - ("MST", "MST"), - ("MST7MDT", "MST7MDT"), - ("Mexico/BajaNorte", "BajaNorte"), - ("Mexico/BajaSur", "BajaSur"), - ("Mexico/General", "General"), - ("NZ", "NZ"), - ("NZ-CHAT", "NZ-CHAT"), - ("Navajo", "Navajo"), - ("PRC", "PRC"), - ("PST8PDT", "PST8PDT"), - ("Pacific/Apia", "Apia"), - ("Pacific/Auckland", "Auckland"), - ("Pacific/Bougainville", "Bougainville"), - ("Pacific/Chatham", "Chatham"), - ("Pacific/Chuuk", "Chuuk"), - ("Pacific/Easter", "Easter"), - ("Pacific/Efate", "Efate"), - ("Pacific/Enderbury", "Enderbury"), - ("Pacific/Fakaofo", "Fakaofo"), - ("Pacific/Fiji", "Fiji"), - ("Pacific/Funafuti", "Funafuti"), - ("Pacific/Galapagos", "Galapagos"), - ("Pacific/Gambier", "Gambier"), - ("Pacific/Guadalcanal", "Guadalcanal"), - ("Pacific/Guam", "Guam"), - ("Pacific/Honolulu", "Honolulu"), - ("Pacific/Johnston", "Johnston"), - ("Pacific/Kanton", "Kanton"), - ("Pacific/Kiritimati", "Kiritimati"), - ("Pacific/Kosrae", "Kosrae"), - ("Pacific/Kwajalein", "Kwajalein"), - ("Pacific/Majuro", "Majuro"), - ("Pacific/Marquesas", "Marquesas"), - ("Pacific/Midway", "Midway"), - ("Pacific/Nauru", "Nauru"), - ("Pacific/Niue", "Niue"), - ("Pacific/Norfolk", "Norfolk"), - ("Pacific/Noumea", "Noumea"), - ("Pacific/Pago_Pago", "Pago_Pago"), - ("Pacific/Palau", "Palau"), - ("Pacific/Pitcairn", "Pitcairn"), - ("Pacific/Pohnpei", "Pohnpei"), - ("Pacific/Ponape", "Ponape"), - ("Pacific/Port_Moresby", "Port_Moresby"), - ("Pacific/Rarotonga", "Rarotonga"), - ("Pacific/Saipan", "Saipan"), - ("Pacific/Samoa", "Samoa"), - ("Pacific/Tahiti", "Tahiti"), - ("Pacific/Tarawa", "Tarawa"), - ("Pacific/Tongatapu", "Tongatapu"), - ("Pacific/Truk", "Truk"), - ("Pacific/Wake", "Wake"), - ("Pacific/Wallis", "Wallis"), - ("Pacific/Yap", "Yap"), - ("Poland", "Poland"), - ("Portugal", "Portugal"), - ("ROC", "ROC"), - ("ROK", "ROK"), - ("Singapore", "Singapore"), - ("SystemV/AST4", "AST4"), - ("SystemV/AST4ADT", "AST4ADT"), - ("SystemV/CST6", "CST6"), - ("SystemV/CST6CDT", "CST6CDT"), - ("SystemV/EST5", "EST5"), - ("SystemV/EST5EDT", "EST5EDT"), - ("SystemV/HST10", "HST10"), - ("SystemV/MST7", "MST7"), - ("SystemV/MST7MDT", "MST7MDT"), - ("SystemV/PST8", "PST8"), - ("SystemV/PST8PDT", "PST8PDT"), - ("SystemV/YST9", "YST9"), - ("SystemV/YST9YDT", "YST9YDT"), - ("Turkey", "Turkey"), - ("UCT", "UCT"), - ("US/Alaska", "Alaska"), - ("US/Aleutian", "Aleutian"), - ("US/Arizona", "Arizona"), - ("US/Central", "Central"), - ("US/East-Indiana", "East-Indiana"), - ("US/Eastern", "Eastern"), - ("US/Hawaii", "Hawaii"), - ("US/Indiana-Starke", "Indiana-Starke"), - ("US/Michigan", "Michigan"), - ("US/Mountain", "Mountain"), - ("US/Pacific", "Pacific"), - ("US/Samoa", "Samoa"), - ("UTC", "UTC"), - ("Universal", "Universal"), - ("W-SU", "W-SU"), - ("WET", "WET"), - ("Zulu", "Zulu"), - ("localtime", "localtime"), - ], - default="Europe/Berlin", - max_length=150, - verbose_name="timezone", + default="Europe/Berlin", max_length=150, verbose_name="timezone" ), ), ] diff --git a/integreat_cms/cms/models/regions/region.py b/integreat_cms/cms/models/regions/region.py index 8686096730..06a2bb217c 100644 --- a/integreat_cms/cms/models/regions/region.py +++ b/integreat_cms/cms/models/regions/region.py @@ -11,7 +11,6 @@ from django.utils.translation import override, ugettext, ugettext_lazy as _ from django.conf import settings -from zoneinfo import available_timezones from ...constants import region_status, administrative_division from ...utils.translation_utils import ugettext_many_lazy as __ @@ -23,21 +22,6 @@ logger = logging.getLogger(__name__) -def get_timezone_choices(): - """ - This method generates the options for the timezone dropdown - - :return: A list of all available timezones - :rtype: list - """ - timezones = list(available_timezones()) - timezones.sort() - - return [("", "---------")] + [ - (tz, tz.split("/", 1)[1] if "/" in tz else tz) for tz in timezones - ] - - # pylint: disable=too-few-public-methods class RegionManager(models.Manager): """ @@ -162,10 +146,8 @@ class Region(AbstractBaseModel): verbose_name=_("email address of the administrator"), ) - TIMEZONES = [(tz, tz) for tz in available_timezones()] timezone = models.CharField( max_length=150, - choices=get_timezone_choices(), default=settings.CURRENT_TIME_ZONE, verbose_name=_("timezone"), ) diff --git a/integreat_cms/cms/templates/regions/region_form.html b/integreat_cms/cms/templates/regions/region_form.html index 5c85932cb2..5a28542dc7 100644 --- a/integreat_cms/cms/templates/regions/region_form.html +++ b/integreat_cms/cms/templates/regions/region_form.html @@ -104,9 +104,6 @@

{{ form.timezone_area.label }} {% render_field form.timezone_area %}
{{ form.timezone_area.help_text }}
-

-
- {% render_field form.timezone %}
{{ form.timezone.help_text }}
diff --git a/integreat_cms/core/middleware/__init__.py b/integreat_cms/core/middleware/__init__.py index 57fdd3dd04..73898fd481 100644 --- a/integreat_cms/core/middleware/__init__.py +++ b/integreat_cms/core/middleware/__init__.py @@ -3,3 +3,4 @@ """ from .access_control_middleware import AccessControlMiddleware from .region_middleware import RegionMiddleware +from .timezone_middleware import TimezoneMiddleware diff --git a/integreat_cms/cms/middleware/timezone_middleware.py b/integreat_cms/core/middleware/timezone_middleware.py similarity index 85% rename from integreat_cms/cms/middleware/timezone_middleware.py rename to integreat_cms/core/middleware/timezone_middleware.py index 8344c55d01..446b77261e 100644 --- a/integreat_cms/cms/middleware/timezone_middleware.py +++ b/integreat_cms/core/middleware/timezone_middleware.py @@ -27,5 +27,8 @@ def __call__(self, request): :return: The response after the local timezone has been activated :rtype: ~django.http.HttpResponse """ - timezone.activate(settings.CURRENT_TIME_ZONE) + if request.region: + timezone.activate(request.region.timezone) + else: + timezone.activate(settings.CURRENT_TIME_ZONE) return self.get_response(request) diff --git a/integreat_cms/core/settings.py b/integreat_cms/core/settings.py index 7ed792b832..742fb0ba83 100644 --- a/integreat_cms/core/settings.py +++ b/integreat_cms/core/settings.py @@ -179,7 +179,7 @@ "django.middleware.clickjacking.XFrameOptionsMiddleware", "integreat_cms.core.middleware.RegionMiddleware", "integreat_cms.core.middleware.AccessControlMiddleware", - "integreat_cms.cms.middleware.TimezoneMiddleware", + "integreat_cms.core.middleware.TimezoneMiddleware", ] # The Django debug toolbar middleware will only be activated if the debug_toolbar app is installed diff --git a/integreat_cms/locale/de/LC_MESSAGES/django.po b/integreat_cms/locale/de/LC_MESSAGES/django.po index b471cdade7..1c2c60486f 100644 --- a/integreat_cms/locale/de/LC_MESSAGES/django.po +++ b/integreat_cms/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-20 16:40+0000\n" +"POT-Creation-Date: 2022-04-23 15:38+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Integreat \n" "Language-Team: Integreat \n" @@ -1293,12 +1293,12 @@ msgstr "Einmalig stattfindende Veranstaltungen" msgid "Active" msgstr "Aktiv" -#: cms/constants/region_status.py:17 cms/models/regions/region.py:624 +#: cms/constants/region_status.py:17 cms/models/regions/region.py:606 msgid "Hidden" msgstr "Versteckt" #: cms/constants/region_status.py:18 cms/models/pages/page.py:323 -#: cms/models/regions/region.py:627 cms/templates/events/event_form.html:70 +#: cms/models/regions/region.py:609 cms/templates/events/event_form.html:70 #: cms/templates/pages/page_form.html:93 #: cms/templates/pages/page_tree_archived_node.html:81 #: cms/templates/pois/poi_form.html:60 @@ -1701,45 +1701,45 @@ msgstr "Quell-Region für Live-Inhalte" msgid "Enable write access via API for this page" msgstr "Schreib-Zugriff via API für diese Seite aktivieren" -#: cms/forms/regions/region_form.py:33 +#: cms/forms/regions/region_form.py:57 msgid "Other timezones" msgstr "Sonstige Zeitzonen" -#: cms/forms/regions/region_form.py:44 +#: cms/forms/regions/region_form.py:68 msgid "Do no import initial content" msgstr "Keine Inhalte übernehmen" -#: cms/forms/regions/region_form.py:50 +#: cms/forms/regions/region_form.py:74 msgid "Timezone area" msgstr "Region der Zeitzone" -#: cms/forms/regions/region_form.py:156 +#: cms/forms/regions/region_form.py:181 msgid "Statistics can only be enabled when a valid access token is supplied." msgstr "" "Statistiken können nur aktiviert werden, wenn ein gültiges Zugangstoken " "eingegeben wurde." -#: cms/forms/regions/region_form.py:168 +#: cms/forms/regions/region_form.py:193 msgid "The provided access token is invalid." msgstr "Das eingegebene Zugangstoken ist ungültig." -#: cms/forms/regions/region_form.py:251 +#: cms/forms/regions/region_form.py:276 msgid "'{}' is already selected as administrative division." msgstr "'{}' ist bereits als Verwaltungseinheit ausgewählt." -#: cms/forms/regions/region_form.py:256 +#: cms/forms/regions/region_form.py:281 msgid "Please select '{}' as administrative division." msgstr "Bitte wählen Sie '{}' als Verwaltungseinheit." -#: cms/forms/regions/region_form.py:267 +#: cms/forms/regions/region_form.py:292 msgid "Please set {} as default language for this region." msgstr "Bitte setzen Sie '{}' als Standard-Sprache für diese Region." -#: cms/forms/regions/region_form.py:273 +#: cms/forms/regions/region_form.py:298 msgid "Please enable '{}'." msgstr "Bitte aktivieren Sie '{}'." -#: cms/forms/regions/region_form.py:288 +#: cms/forms/regions/region_form.py:313 msgid "" "You cannot include the administrative division into the name and use a " "custom prefix at the same time." @@ -1859,7 +1859,7 @@ msgstr "Die Passwörter stimmen nicht überein." #: cms/models/feedback/feedback.py:60 cms/models/media/directory.py:24 #: cms/models/media/media_file.py:138 #: cms/models/push_notifications/push_notification.py:21 -#: cms/models/regions/region.py:643 +#: cms/models/regions/region.py:625 msgid "region" msgstr "Region" @@ -1868,7 +1868,7 @@ msgstr "Region" #: cms/models/languages/language_tree_node.py:37 #: cms/models/media/directory.py:36 cms/models/offers/offer_template.py:56 #: cms/models/push_notifications/push_notification.py:45 -#: cms/models/regions/region.py:174 cms/models/users/organization.py:34 +#: cms/models/regions/region.py:156 cms/models/users/organization.py:34 #: cms/models/users/user_mfa_key.py:39 msgid "creation date" msgstr "Erstellungsdatum" @@ -1899,7 +1899,7 @@ msgstr "" "generieren." #: cms/models/abstract_content_translation.py:38 -#: cms/models/regions/region.py:107 +#: cms/models/regions/region.py:91 msgid "status" msgstr "Status" @@ -1948,7 +1948,7 @@ msgstr "" #: cms/models/languages/language_tree_node.py:41 #: cms/models/offers/offer_template.py:60 #: cms/models/push_notifications/push_notification_translation.py:37 -#: cms/models/regions/region.py:178 cms/models/users/organization.py:38 +#: cms/models/regions/region.py:160 cms/models/users/organization.py:38 msgid "modification date" msgstr "Änderungsdatum" @@ -2396,7 +2396,7 @@ msgid "language tree nodes" msgstr "Sprach-Knoten" #: cms/models/media/directory.py:17 cms/models/media/media_file.py:123 -#: cms/models/offers/offer_template.py:17 cms/models/regions/region.py:81 +#: cms/models/offers/offer_template.py:17 cms/models/regions/region.py:65 #: cms/models/users/organization.py:14 cms/models/users/role.py:20 msgid "name" msgstr "Name" @@ -2463,7 +2463,7 @@ msgstr "Medien-Dateien" msgid "slug" msgstr "URL-Parameter" -#: cms/models/offers/offer_template.py:25 cms/models/regions/region.py:99 +#: cms/models/offers/offer_template.py:25 cms/models/regions/region.py:83 msgid "Leave blank to generate unique parameter from name" msgstr "" "Dieses Feld freilassen, um einen eindeutigen Alias aus dem Namen zu " @@ -2492,7 +2492,7 @@ msgstr "POST-Parameter" msgid "Additional POST data for retrieving the URL." msgstr "Zusätzliche POST-Daten zum Abrufen der URL." -#: cms/models/offers/offer_template.py:40 cms/models/regions/region.py:124 +#: cms/models/offers/offer_template.py:40 cms/models/regions/region.py:108 msgid "Specify as JSON." msgstr "Als JSON angeben." @@ -2681,7 +2681,7 @@ msgstr "Leer" msgid "street and house number" msgstr "Straße und Hausnummer" -#: cms/models/pois/poi.py:18 cms/models/regions/region.py:159 +#: cms/models/pois/poi.py:18 cms/models/regions/region.py:143 msgid "postal code" msgstr "Postleitzahl" @@ -2693,7 +2693,7 @@ msgstr "Stadt" msgid "country" msgstr "Land" -#: cms/models/pois/poi.py:22 cms/models/regions/region.py:151 +#: cms/models/pois/poi.py:22 cms/models/regions/region.py:135 msgid "latitude" msgstr "Geographische Breite" @@ -2701,7 +2701,7 @@ msgstr "Geographische Breite" msgid "The latitude coordinate" msgstr "Die Breitengrad-Koordinate" -#: cms/models/pois/poi.py:25 cms/models/regions/region.py:156 +#: cms/models/pois/poi.py:25 cms/models/regions/region.py:140 msgid "longitude" msgstr "Geographische Länge" @@ -2788,50 +2788,50 @@ msgstr "Push-Benachrichtigungs-Übersetzung" msgid "push notification translations" msgstr "Push-Benachrichtigungs-Übersetzungen" -#: cms/models/regions/region.py:87 +#: cms/models/regions/region.py:71 msgid "community identification number" msgstr "Amtlicher Gemeindeschlüssel" -#: cms/models/regions/region.py:89 +#: cms/models/regions/region.py:73 msgid "" "Number sequence for identifying politically independent administrative units" msgstr "" "Ziffernfolge zur Identifizierung politisch selbständiger Verwaltungseinheiten" -#: cms/models/regions/region.py:96 +#: cms/models/regions/region.py:80 msgid "URL parameter" msgstr "URL-Parameter" -#: cms/models/regions/region.py:98 cms/models/users/organization.py:20 +#: cms/models/regions/region.py:82 cms/models/users/organization.py:20 msgid "Unique string identifier without spaces and special characters." msgstr "Eindeutiger Bezeichner ohne Leerzeichen und Sonderzeichen." -#: cms/models/regions/region.py:116 +#: cms/models/regions/region.py:100 msgid "administrative division" msgstr "Verwaltungseinheit" -#: cms/models/regions/region.py:120 +#: cms/models/regions/region.py:104 msgid "aliases" msgstr "Aliasnamen" -#: cms/models/regions/region.py:122 +#: cms/models/regions/region.py:106 msgid "E.g. smaller municipalities in that area." msgstr "Z.B. kleinere Gemeinden in der Region." -#: cms/models/regions/region.py:123 +#: cms/models/regions/region.py:107 msgid "If empty, the CMS will try to fill this automatically." msgstr "Wird, wenn leer, automatisch vom CMS befüllt." -#: cms/models/regions/region.py:130 +#: cms/models/regions/region.py:114 msgid "custom prefix" msgstr "Benutzerdefiniertes Präfix" -#: cms/models/regions/region.py:132 +#: cms/models/regions/region.py:116 msgid "Enter parts of the name that should not affect sorting." msgstr "" "Geben Sie Teile des Namens ein, die die Sortierung nicht beeinflussen sollen." -#: cms/models/regions/region.py:134 +#: cms/models/regions/region.py:118 msgid "" "Use this field only if the prefix is not an available choice in the list of " "administrative divisions above." @@ -2839,63 +2839,63 @@ msgstr "" "Verwenden Sie dieses Feld nur, wenn das Präfix in der obigen Liste der " "Verwaltungseinheiten nicht zur Auswahl steht." -#: cms/models/regions/region.py:141 +#: cms/models/regions/region.py:125 msgid "activate events" msgstr "Veranstaltungen aktivieren" -#: cms/models/regions/region.py:142 +#: cms/models/regions/region.py:126 msgid "Whether or not events are enabled in the region" msgstr "Ob Veranstaltungen in der Region aktiviert sind oder nicht" -#: cms/models/regions/region.py:146 +#: cms/models/regions/region.py:130 msgid "activate push notifications" msgstr "Push-Benachrichtigungen aktivieren" -#: cms/models/regions/region.py:147 +#: cms/models/regions/region.py:131 msgid "Whether or not push notifications are enabled in the region" msgstr "Ob Push-Benachrichtigungen in der Region aktiviert sind oder nicht" -#: cms/models/regions/region.py:152 +#: cms/models/regions/region.py:136 msgid "The latitude coordinate of an approximate center of the region" msgstr "Die Breitengrad-Koordinate eines ungefähren Mittelpunkts der Region" -#: cms/models/regions/region.py:157 +#: cms/models/regions/region.py:141 msgid "The longitude coordinate of an approximate center of the region" msgstr "Die Längengrad-Koordinate eines ungefähren Mittelpunkts der Region" -#: cms/models/regions/region.py:162 +#: cms/models/regions/region.py:146 msgid "email address of the administrator" msgstr "E-Mail-Adresse des Administrators" -#: cms/models/regions/region.py:170 +#: cms/models/regions/region.py:152 msgid "timezone" msgstr "Zeitzone" -#: cms/models/regions/region.py:183 +#: cms/models/regions/region.py:165 msgid "activate statistics" msgstr "Statistiken aktivieren" -#: cms/models/regions/region.py:184 +#: cms/models/regions/region.py:166 msgid "Whether or not statistics are enabled for the region" msgstr "Ob Statistiken für die Region aktiviert sind oder nicht" -#: cms/models/regions/region.py:189 +#: cms/models/regions/region.py:171 msgid "Matomo ID" msgstr "Matomo ID" -#: cms/models/regions/region.py:191 +#: cms/models/regions/region.py:173 msgid "The Matomo ID of this region." msgstr "Die Matomo ID dieser region." -#: cms/models/regions/region.py:192 +#: cms/models/regions/region.py:174 msgid "Will be automatically derived from the Matomo access token." msgstr "Wird automatisch vom Matomo Zugangstoken abgeleitet." -#: cms/models/regions/region.py:199 +#: cms/models/regions/region.py:181 msgid "Matomo authentication token" msgstr "Matomo Authentifizierungs-Token" -#: cms/models/regions/region.py:201 +#: cms/models/regions/region.py:183 msgid "" "The secret Matomo access token of the region is used to authenticate in API " "requests" @@ -2903,11 +2903,11 @@ msgstr "" "Das geheime Matomo-Zugangs-Token der Region wird zur Authentifizierung bei " "API-Anfragen verwendet" -#: cms/models/regions/region.py:207 +#: cms/models/regions/region.py:189 msgid "activate page-specific permissions" msgstr "Seiten-spezifische-Berechtigungen aktivieren" -#: cms/models/regions/region.py:209 +#: cms/models/regions/region.py:191 msgid "" "This allows individual users to be granted the right to edit or publish a " "specific page." @@ -2915,26 +2915,26 @@ msgstr "" "Damit kann einzelnen Benutzern das Recht zum Bearbeiten oder Veröffentlichen " "einer bestimmten Seite eingeräumt werden." -#: cms/models/regions/region.py:215 cms/models/users/organization.py:25 +#: cms/models/regions/region.py:197 cms/models/users/organization.py:25 msgid "logo" msgstr "Logo" -#: cms/models/regions/region.py:224 +#: cms/models/regions/region.py:206 msgid "activate author chat" msgstr "Autoren-Chat aktivieren" -#: cms/models/regions/region.py:226 +#: cms/models/regions/region.py:208 msgid "" "This gives all users of this region access to the cross-regional author chat." msgstr "" "Dies gewährt allen Benutzern dieser Region Zugang zum überregionalen Autoren-" "Chat." -#: cms/models/regions/region.py:232 +#: cms/models/regions/region.py:214 msgid "include administrative division into name" msgstr "Verwaltungseinheit dem Namen hinzufügen" -#: cms/models/regions/region.py:235 +#: cms/models/regions/region.py:217 msgid "" "Determines whether the administrative division is displayed next to the " "region name." @@ -2942,7 +2942,7 @@ msgstr "" "Legt fest, ob die Verwaltungseinheit neben dem Namen der Region angezeigt " "wird." -#: cms/models/regions/region.py:238 +#: cms/models/regions/region.py:220 msgid "" "Sorting is always based on the name, independently from the administrative " "division." @@ -2950,11 +2950,11 @@ msgstr "" "Sortierungen werden immer auf Grundlage der Namen vorgenommen, unabhängig " "von der Verwaltungseinheit." -#: cms/models/regions/region.py:247 +#: cms/models/regions/region.py:229 msgid "offers" msgstr "Angebote" -#: cms/models/regions/region.py:250 +#: cms/models/regions/region.py:232 msgid "" "Integreat offers are extended features apart from pages and events and are " "usually offered by a third party." @@ -2962,7 +2962,7 @@ msgstr "" "Integreat Angebote sind erweiterte Funktionen jenseits von Seiten und " "Ereignissen und werden in der Regel von Drittanbietern bereitgestellt." -#: cms/models/regions/region.py:253 +#: cms/models/regions/region.py:235 msgid "" "In most cases, the url is an external API endpoint which the frontend apps " "can query and render the results inside the Integreat app." @@ -2971,23 +2971,23 @@ msgstr "" "Frontend Anfragen gesendet werden, um die Ergebnisse in der Integreat App " "einzubetten." -#: cms/models/regions/region.py:260 +#: cms/models/regions/region.py:242 msgid "Activate short urls" msgstr "Kurz-URLs aktivieren" -#: cms/models/regions/region.py:261 +#: cms/models/regions/region.py:243 msgid "Please check the box if you want to use short urls." msgstr "Kreuzen Sie an, wenn Sie Kurz-URLs benutzen wollen." -#: cms/models/regions/region.py:266 +#: cms/models/regions/region.py:248 msgid "Enable tunews" msgstr "tünews aktivieren" -#: cms/models/regions/region.py:267 +#: cms/models/regions/region.py:249 msgid "Enable to show a feed of tunews articles to users." msgstr "Auswählen, um Benutzern einen tünews-Feed anzuzeigen." -#: cms/models/regions/region.py:645 cms/models/users/user.py:56 +#: cms/models/regions/region.py:627 cms/models/users/user.py:56 msgid "regions" msgstr "Regionen" @@ -3135,7 +3135,7 @@ msgstr "Mein Dashboard" msgid "Analytics" msgstr "Analyse" -#: cms/templates/_base.html:118 cms/templates/regions/region_form.html:140 +#: cms/templates/_base.html:118 cms/templates/regions/region_form.html:137 #: cms/templates/statistics/_statistics_widget.html:11 #: cms/templates/statistics/statistics_overview.html:10 #: cms/templates/statistics/statistics_overview.html:49 @@ -5221,38 +5221,38 @@ msgstr "Neue Region erstellen" msgid "Center of the region" msgstr "Mittelpunkt der Region" -#: cms/templates/regions/region_form.html:177 +#: cms/templates/regions/region_form.html:174 msgid "Duplicate content of another region" msgstr "Inhalte aus einer anderen Region duplizieren" -#: cms/templates/regions/region_form.html:180 +#: cms/templates/regions/region_form.html:177 msgid "Copy languages, pages and media from another region" msgstr "Sprachen, Seiten und Medien aus einer anderen Region kopieren" -#: cms/templates/regions/region_form.html:189 +#: cms/templates/regions/region_form.html:186 msgid "Delete region" msgstr "Region löschen" -#: cms/templates/regions/region_form.html:190 +#: cms/templates/regions/region_form.html:187 msgid "Please confirm that you really want to delete this region." msgstr "Bitte bestätigen Sie, dass diese Region gelöscht werden soll" -#: cms/templates/regions/region_form.html:191 +#: cms/templates/regions/region_form.html:188 msgid "This can not be reversed." msgstr "Dies kann nicht rückgängig gemacht werden." -#: cms/templates/regions/region_form.html:191 +#: cms/templates/regions/region_form.html:188 msgid "All pages, events and locations of this region will also be deleted." msgstr "" "Alle Seiten, Veranstaltungen und Orte dieser Region werden ebenfalls " "gelöscht." -#: cms/templates/regions/region_form.html:191 +#: cms/templates/regions/region_form.html:188 msgid "Users, who only have access to this region, will be removed as well." msgstr "" "Benutzer, die nur Zugriff auf diese Region besitzen, werden auch entfernt." -#: cms/templates/regions/region_form.html:195 +#: cms/templates/regions/region_form.html:192 msgid "Delete this region" msgstr "Diese Region löschen" diff --git a/integreat_cms/static/src/js/regions/conditional-fields.ts b/integreat_cms/static/src/js/regions/conditional-fields.ts index 07120bdbe3..534a8370ac 100644 --- a/integreat_cms/static/src/js/regions/conditional-fields.ts +++ b/integreat_cms/static/src/js/regions/conditional-fields.ts @@ -38,21 +38,19 @@ window.addEventListener('load', () => { } }); -function updateTimezoneAreaDropdown() { +function updateTimezoneAreaDropdown(event?: Event) { const timezoneAreaDropdown = document.getElementById("id_timezone_area") as HTMLSelectElement; const timezoneDropdown = document.getElementById("id_timezone") as HTMLSelectElement; - let otherOptions; - let selectedOptions; - timezoneDropdown.value = ''; - if (timezoneAreaDropdown.value === '') { - selectedOptions = []; - otherOptions = timezoneDropdown.querySelectorAll('option'); - } else { - otherOptions = timezoneDropdown.querySelectorAll('option:not([value*="' + timezoneAreaDropdown.value + '"])'); - selectedOptions = timezoneDropdown.querySelectorAll('option[value*="' + timezoneAreaDropdown.value + '"]'); + // Reset timezone value when timezone region is changed + if (event !== undefined) { + timezoneDropdown.value = ""; } - otherOptions.forEach((option) => option.classList.add('hidden')); - selectedOptions.forEach((option) => option.classList.remove('hidden')); - - timezoneDropdown.querySelector('option[value=""]').classList.remove('hidden'); -} \ No newline at end of file + // Hide all sub-timzones of other areas + timezoneDropdown + .querySelectorAll('option:not([value*="' + timezoneAreaDropdown.value + '"],[value=""])') + .forEach((option) => option.classList.add("hidden")); + // Show all sub-timezones of the selected area + timezoneDropdown + .querySelectorAll('option[value*="' + timezoneAreaDropdown.value + '"]') + .forEach((option) => option.classList.remove("hidden")); +} diff --git a/tests/cms/test_duplicate_regions.py b/tests/cms/test_duplicate_regions.py index 5a908e18c6..0e0177e636 100644 --- a/tests/cms/test_duplicate_regions.py +++ b/tests/cms/test_duplicate_regions.py @@ -29,6 +29,7 @@ def test_duplicate_regions(load_test_data, admin_client): "longitude": 1, "latitude": 1, "duplicated_region": 1, + "timezone": "Europe/Berlin", }, ) print(response.headers) diff --git a/tests/cms/views/view_config.py b/tests/cms/views/view_config.py index c1cd3e0099..9e8ab0273c 100644 --- a/tests/cms/views/view_config.py +++ b/tests/cms/views/view_config.py @@ -282,6 +282,7 @@ "status": "ACTIVE", "longitude": 1, "latitude": 1, + "timezone": "Europe/Berlin", }, ), ], From 83d7b65da761ccfc53b3ecd028a78103aee8a4ff Mon Sep 17 00:00:00 2001 From: Timo Ludwig Date: Tue, 19 Apr 2022 21:20:53 +0200 Subject: [PATCH 4/5] Add Malte and Aschaffenburg brandings --- CHANGELOG.md | 1 + README.md | 7 + example-configs/integreat-cms.ini | 6 + integreat_cms/cms/templates/_base.html | 6 +- integreat_cms/cms/templates/_raw.html | 4 +- .../analytics/_website_size_widget.html | 11 +- .../cms/templates/authentication/_base.html | 6 +- .../cms/templates/authentication/login.html | 2 +- .../password_reset_confirm.html | 2 +- .../authentication/password_reset_email.html | 10 +- .../password_reset_email_subject.html | 2 +- .../authentication/password_reset_form.html | 2 +- .../cms/templates/chat/_chat_messages.html | 2 +- .../templates/error_handler/http_error.html | 2 +- .../cms/templates/events/event_list.html | 7 +- .../cms/templates/pages/page_pdf.html | 2 +- .../cms/templates/pois/poi_list.html | 7 +- .../cms/templates/users/user_form.html | 2 +- .../cms/templates/users/user_list.html | 2 +- .../cms/templates/users/welcome_email.html | 23 +- .../cms/templates/users/welcome_email.txt | 8 +- integreat_cms/cms/urls/public.py | 62 ++++- integreat_cms/cms/utils/pdf_utils.py | 4 +- integreat_cms/cms/utils/welcome_mail_utils.py | 11 +- .../cms/views/error_handler/error_handler.py | 8 + integreat_cms/core/context_processors.py | 14 ++ integreat_cms/core/settings.py | 20 ++ integreat_cms/core/urls.py | 3 +- integreat_cms/locale/de/LC_MESSAGES/django.po | 220 ++++++++++-------- integreat_cms/static/src/css/style.scss | 40 +++- .../src/images/integreat-icon-contur-only.png | Bin 1622 -> 0 bytes .../static/src/images/integreat-icon.png | Bin 8263 -> 0 bytes .../src/images/integreat-logo-white.png | Bin 8009 -> 0 bytes .../src/images/integreat-logo-yellow.png | Bin 10651 -> 0 bytes .../static/src/images/integreat-logo.jpg | Bin 8669 -> 0 bytes .../static/src/images/integreat-logo.png | Bin 7956 -> 0 bytes .../static/src/images/integreat-logo.svg | 73 ------ integreat_cms/static/src/logos/LICENSE.txt | 1 + integreat_cms/static/src/logos/README.md | 3 + .../aschaffenburg/aschaffenburg-icon.svg | 1 + .../aschaffenburg/aschaffenburg-logo-cyan.svg | 1 + .../aschaffenburg-logo-slate.svg | 1 + .../aschaffenburg-logo-white.svg | 1 + .../aschaffenburg/aschaffenburg-logo.png | Bin 0 -> 58262 bytes .../logos/integreat/integreat-icon-flat.svg | 1 + .../src/logos/integreat/integreat-icon.svg | 1 + .../logos/integreat/integreat-logo-black.svg | 1 + .../logos/integreat/integreat-logo-white.svg | 1 + .../logos/integreat/integreat-logo-yellow.svg | 1 + .../src/logos/integreat/integreat-logo.png | Bin 0 -> 18501 bytes .../static/src/logos/malte/malte-icon.svg | 1 + .../src/logos/malte/malte-logo-black.svg | 1 + .../static/src/logos/malte/malte-logo-red.svg | 1 + .../src/logos/malte/malte-logo-white.svg | 125 ++++++++++ .../static/src/logos/malte/malte-logo.png | Bin 0 -> 15918 bytes sphinx/conf.py | 13 +- tailwind.config.js | 35 +-- webpack.config.js | 1 + 58 files changed, 509 insertions(+), 250 deletions(-) delete mode 100644 integreat_cms/static/src/images/integreat-icon-contur-only.png delete mode 100644 integreat_cms/static/src/images/integreat-icon.png delete mode 100644 integreat_cms/static/src/images/integreat-logo-white.png delete mode 100644 integreat_cms/static/src/images/integreat-logo-yellow.png delete mode 100644 integreat_cms/static/src/images/integreat-logo.jpg delete mode 100644 integreat_cms/static/src/images/integreat-logo.png delete mode 100644 integreat_cms/static/src/images/integreat-logo.svg create mode 100644 integreat_cms/static/src/logos/LICENSE.txt create mode 100644 integreat_cms/static/src/logos/README.md create mode 100644 integreat_cms/static/src/logos/aschaffenburg/aschaffenburg-icon.svg create mode 100644 integreat_cms/static/src/logos/aschaffenburg/aschaffenburg-logo-cyan.svg create mode 100644 integreat_cms/static/src/logos/aschaffenburg/aschaffenburg-logo-slate.svg create mode 100644 integreat_cms/static/src/logos/aschaffenburg/aschaffenburg-logo-white.svg create mode 100755 integreat_cms/static/src/logos/aschaffenburg/aschaffenburg-logo.png create mode 100755 integreat_cms/static/src/logos/integreat/integreat-icon-flat.svg create mode 100755 integreat_cms/static/src/logos/integreat/integreat-icon.svg create mode 100644 integreat_cms/static/src/logos/integreat/integreat-logo-black.svg create mode 100644 integreat_cms/static/src/logos/integreat/integreat-logo-white.svg create mode 100644 integreat_cms/static/src/logos/integreat/integreat-logo-yellow.svg create mode 100644 integreat_cms/static/src/logos/integreat/integreat-logo.png create mode 100644 integreat_cms/static/src/logos/malte/malte-icon.svg create mode 100644 integreat_cms/static/src/logos/malte/malte-logo-black.svg create mode 100644 integreat_cms/static/src/logos/malte/malte-logo-red.svg create mode 100644 integreat_cms/static/src/logos/malte/malte-logo-white.svg create mode 100644 integreat_cms/static/src/logos/malte/malte-logo.png diff --git a/CHANGELOG.md b/CHANGELOG.md index ec271100b1..f4ddf32a20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ UNRELEASED * [ [#1366](https://github.com/digitalfabrik/integreat-cms/issues/1366) ] Fix monthly recurring events on mondays * [ [#1365](https://github.com/digitalfabrik/integreat-cms/issues/1365) ] Add timezone setting to region model +* [ [#1093](https://github.com/digitalfabrik/integreat-cms/issues/1093) ] Add Malte and Aschaffenburg brandings 2022.4.1 diff --git a/README.md b/README.md index 6e6ab5a26c..436367e0cc 100644 --- a/README.md +++ b/README.md @@ -48,3 +48,10 @@ cd integreat-cms For detailed instructions, tutorials and the source code reference have a look at our great documentation:

:notebook: https://digitalfabrik.github.io/integreat-cms/

+ + +## License + +This project is licensed under the Apache 2.0 License, see [LICENSE.txt](./LICENSE.txt) + +All files in [./integreat_cms/static/src/logos/](./integreat_cms/static/src/logos/) are not covered by this license and may only be used with specific permission of the copyright holder. diff --git a/example-configs/integreat-cms.ini b/example-configs/integreat-cms.ini index 51ac696b7e..7a0aca3d39 100644 --- a/example-configs/integreat-cms.ini +++ b/example-configs/integreat-cms.ini @@ -12,6 +12,12 @@ DEBUG = False # The timezone of the server [optional, defaults to "Europe/Berlin"] CURRENT_TIME_ZONE = Europe/Berlin +# The company operating this CMS [optional, defaults to "Tür an Tür – Digitalfabrik gGmbH"] +COMPANY = Tür an Tür – Digitalfabrik gGmbH +# The URL to the company's website [optional, defaults to "https://tuerantuer.de/digitalfabrik/"] +COMPANY_URL = https://tuerantuer.de/digitalfabrik/ +# The branding of the CMS [optional, defaults to "integreat", must be one of ["integreat", "malte", "aschaffenburg"]] +BRANDING = integreat [secrets] # The secret key for this installation [required] diff --git a/integreat_cms/cms/templates/_base.html b/integreat_cms/cms/templates/_base.html index 490d5fb91e..bcb583f3f5 100644 --- a/integreat_cms/cms/templates/_base.html +++ b/integreat_cms/cms/templates/_base.html @@ -25,7 +25,7 @@ fill="none" width="21" height="21" - src="{% static 'images/integreat-icon-contur-only.png' %}"/> + src="{% static 'logos/integreat/integreat-icon-flat.svg' %}"/> {% trans 'Documentation (Wiki)' %}
-