diff --git a/OneSila/contacts/migrations/0005_alter_address_options_alter_invoiceaddress_options_and_more.py b/OneSila/contacts/migrations/0005_alter_address_options_alter_invoiceaddress_options_and_more.py new file mode 100644 index 00000000..78d065e4 --- /dev/null +++ b/OneSila/contacts/migrations/0005_alter_address_options_alter_invoiceaddress_options_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.6 on 2024-01-02 11:06 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('contacts', '0004_alter_company_options_alter_internalcompany_options_and_more'), + ] + + operations = [ + migrations.AlterModelOptions( + name='address', + options={'verbose_name_plural': 'addresses'}, + ), + migrations.AlterModelOptions( + name='invoiceaddress', + options={'verbose_name_plural': 'invoice addresses'}, + ), + migrations.AlterModelOptions( + name='shippingaddress', + options={'verbose_name_plural': 'shipping addresses'}, + ), + ] diff --git a/OneSila/core/migrations/0013_alter_multitenantuser_timezone.py b/OneSila/core/migrations/0013_alter_multitenantuser_timezone.py new file mode 100644 index 00000000..56b495e3 --- /dev/null +++ b/OneSila/core/migrations/0013_alter_multitenantuser_timezone.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.6 on 2024-01-02 11:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0012_merge_20231216_1625'), + ] + + operations = [ + migrations.AlterField( + model_name='multitenantuser', + name='timezone', + field=models.CharField(choices=[('Africa/Sao_Tome', 'Africa/Sao_Tome'), ('America/Santo_Domingo', 'America/Santo_Domingo'), ('Pacific/Johnston', 'Pacific/Johnston'), ('Asia/Singapore', 'Asia/Singapore'), ('Chile/EasterIsland', 'Chile/EasterIsland'), ('America/Mendoza', 'America/Mendoza'), ('America/Bogota', 'America/Bogota'), ('Africa/Bangui', 'Africa/Bangui'), ('Asia/Ashgabat', 'Asia/Ashgabat'), ('Canada/Atlantic', 'Canada/Atlantic'), ('Africa/Malabo', 'Africa/Malabo'), ('MET', 'MET'), ('America/Nome', 'America/Nome'), ('America/Argentina/Mendoza', 'America/Argentina/Mendoza'), ('Europe/Bratislava', 'Europe/Bratislava'), ('Asia/Chungking', 'Asia/Chungking'), ('PRC', 'PRC'), ('America/Eirunepe', 'America/Eirunepe'), ('America/Yellowknife', 'America/Yellowknife'), ('Atlantic/Canary', 'Atlantic/Canary'), ('Cuba', 'Cuba'), ('Europe/Zagreb', 'Europe/Zagreb'), ('Asia/Chongqing', 'Asia/Chongqing'), ('Pacific/Chuuk', 'Pacific/Chuuk'), ('Asia/Dili', 'Asia/Dili'), ('Japan', 'Japan'), ('Pacific/Rarotonga', 'Pacific/Rarotonga'), ('America/Argentina/San_Juan', 'America/Argentina/San_Juan'), ('America/Thule', 'America/Thule'), ('Africa/Maseru', 'Africa/Maseru'), ('Asia/Ashkhabad', 'Asia/Ashkhabad'), ('America/Antigua', 'America/Antigua'), ('America/Ciudad_Juarez', 'America/Ciudad_Juarez'), ('America/Argentina/Catamarca', 'America/Argentina/Catamarca'), ('America/Dawson_Creek', 'America/Dawson_Creek'), ('Asia/Urumqi', 'Asia/Urumqi'), ('Australia/ACT', 'Australia/ACT'), ('Asia/Thimphu', 'Asia/Thimphu'), ('Asia/Rangoon', 'Asia/Rangoon'), ('Europe/Ljubljana', 'Europe/Ljubljana'), ('America/Jamaica', 'America/Jamaica'), ('Asia/Yangon', 'Asia/Yangon'), ('Asia/Pontianak', 'Asia/Pontianak'), ('Asia/Dhaka', 'Asia/Dhaka'), ('Pacific/Kosrae', 'Pacific/Kosrae'), ('Eire', 'Eire'), ('America/Glace_Bay', 'America/Glace_Bay'), ('Europe/Andorra', 'Europe/Andorra'), ('Atlantic/Faeroe', 'Atlantic/Faeroe'), ('Antarctica/Mawson', 'Antarctica/Mawson'), ('Pacific/Guam', 'Pacific/Guam'), ('Europe/Minsk', 'Europe/Minsk'), ('Europe/San_Marino', 'Europe/San_Marino'), ('America/Halifax', 'America/Halifax'), ('Europe/Vatican', 'Europe/Vatican'), ('Africa/Blantyre', 'Africa/Blantyre'), ('Pacific/Norfolk', 'Pacific/Norfolk'), ('Africa/Dakar', 'Africa/Dakar'), ('Asia/Yerevan', 'Asia/Yerevan'), ('NZ', 'NZ'), ('US/Eastern', 'US/Eastern'), ('Europe/Stockholm', 'Europe/Stockholm'), ('Europe/Copenhagen', 'Europe/Copenhagen'), ('W-SU', 'W-SU'), ('America/Cordoba', 'America/Cordoba'), ('America/Jujuy', 'America/Jujuy'), ('Asia/Oral', 'Asia/Oral'), ('America/Fort_Nelson', 'America/Fort_Nelson'), ('Asia/Almaty', 'Asia/Almaty'), ('Europe/Zurich', 'Europe/Zurich'), ('America/Santa_Isabel', 'America/Santa_Isabel'), ('America/Marigot', 'America/Marigot'), ('Asia/Samarkand', 'Asia/Samarkand'), ('America/North_Dakota/Beulah', 'America/North_Dakota/Beulah'), ('America/Mazatlan', 'America/Mazatlan'), ('America/Creston', 'America/Creston'), ('Asia/Jerusalem', 'Asia/Jerusalem'), ('America/Recife', 'America/Recife'), ('Africa/Bissau', 'Africa/Bissau'), ('Pacific/Pitcairn', 'Pacific/Pitcairn'), ('Europe/Malta', 'Europe/Malta'), ('America/Dominica', 'America/Dominica'), ('Atlantic/Azores', 'Atlantic/Azores'), ('Africa/Windhoek', 'Africa/Windhoek'), ('Pacific/Nauru', 'Pacific/Nauru'), ('America/Manaus', 'America/Manaus'), ('Portugal', 'Portugal'), ('Antarctica/Rothera', 'Antarctica/Rothera'), ('America/Merida', 'America/Merida'), ('America/Guadeloupe', 'America/Guadeloupe'), ('Antarctica/Vostok', 'Antarctica/Vostok'), ('America/Fort_Wayne', 'America/Fort_Wayne'), ('America/Shiprock', 'America/Shiprock'), ('Africa/Asmara', 'Africa/Asmara'), ('America/Maceio', 'America/Maceio'), ('America/Lower_Princes', 'America/Lower_Princes'), ('Africa/Harare', 'Africa/Harare'), ('America/Chicago', 'America/Chicago'), ('ROK', 'ROK'), ('Etc/GMT0', 'Etc/GMT0'), ('America/Boise', 'America/Boise'), ('America/Tegucigalpa', 'America/Tegucigalpa'), ('Australia/Adelaide', 'Australia/Adelaide'), ('Africa/Bamako', 'Africa/Bamako'), ('America/Rainy_River', 'America/Rainy_River'), ('Australia/Melbourne', 'Australia/Melbourne'), ('America/Phoenix', 'America/Phoenix'), ('Etc/GMT-6', 'Etc/GMT-6'), ('America/Puerto_Rico', 'America/Puerto_Rico'), ('America/Montreal', 'America/Montreal'), ('Asia/Karachi', 'Asia/Karachi'), ('Africa/Tripoli', 'Africa/Tripoli'), ('US/Central', 'US/Central'), ('America/Mexico_City', 'America/Mexico_City'), ('Asia/Hong_Kong', 'Asia/Hong_Kong'), ('America/Indiana/Indianapolis', 'America/Indiana/Indianapolis'), ('Indian/Mahe', 'Indian/Mahe'), ('Africa/Casablanca', 'Africa/Casablanca'), ('GB-Eire', 'GB-Eire'), ('Pacific/Wallis', 'Pacific/Wallis'), ('Atlantic/Stanley', 'Atlantic/Stanley'), ('America/Kralendijk', 'America/Kralendijk'), ('America/Miquelon', 'America/Miquelon'), ('NZ-CHAT', 'NZ-CHAT'), ('America/Argentina/San_Luis', 'America/Argentina/San_Luis'), ('Europe/Guernsey', 'Europe/Guernsey'), ('Europe/Uzhgorod', 'Europe/Uzhgorod'), ('Factory', 'Factory'), ('America/Argentina/Tucuman', 'America/Argentina/Tucuman'), ('America/Porto_Velho', 'America/Porto_Velho'), ('Asia/Barnaul', 'Asia/Barnaul'), ('Africa/Timbuktu', 'Africa/Timbuktu'), ('Pacific/Fakaofo', 'Pacific/Fakaofo'), ('Africa/Kigali', 'Africa/Kigali'), ('Etc/GMT-14', 'Etc/GMT-14'), ('Asia/Novosibirsk', 'Asia/Novosibirsk'), ('Asia/Tel_Aviv', 'Asia/Tel_Aviv'), ('America/Vancouver', 'America/Vancouver'), ('Europe/Astrakhan', 'Europe/Astrakhan'), ('Pacific/Saipan', 'Pacific/Saipan'), ('America/Havana', 'America/Havana'), ('Canada/Central', 'Canada/Central'), ('Asia/Ust-Nera', 'Asia/Ust-Nera'), ('Africa/Ceuta', 'Africa/Ceuta'), ('America/Metlakatla', 'America/Metlakatla'), ('Asia/Thimbu', 'Asia/Thimbu'), ('Pacific/Auckland', 'Pacific/Auckland'), ('Asia/Macao', 'Asia/Macao'), ('Asia/Dushanbe', 'Asia/Dushanbe'), ('America/Indiana/Marengo', 'America/Indiana/Marengo'), ('Europe/Skopje', 'Europe/Skopje'), ('America/Asuncion', 'America/Asuncion'), ('America/Iqaluit', 'America/Iqaluit'), ('Asia/Sakhalin', 'Asia/Sakhalin'), ('America/Argentina/Cordoba', 'America/Argentina/Cordoba'), ('Canada/Saskatchewan', 'Canada/Saskatchewan'), ('Africa/Accra', 'Africa/Accra'), ('Etc/Universal', 'Etc/Universal'), ('Europe/Kaliningrad', 'Europe/Kaliningrad'), ('America/Cancun', 'America/Cancun'), ('Europe/Riga', 'Europe/Riga'), ('Europe/Tirane', 'Europe/Tirane'), ('Europe/Bucharest', 'Europe/Bucharest'), ('Brazil/Acre', 'Brazil/Acre'), ('Asia/Colombo', 'Asia/Colombo'), ('Antarctica/Palmer', 'Antarctica/Palmer'), ('America/Lima', 'America/Lima'), ('Antarctica/McMurdo', 'Antarctica/McMurdo'), ('America/Toronto', 'America/Toronto'), ('America/Rio_Branco', 'America/Rio_Branco'), ('America/Argentina/ComodRivadavia', 'America/Argentina/ComodRivadavia'), ('America/Port-au-Prince', 'America/Port-au-Prince'), ('Asia/Taipei', 'Asia/Taipei'), ('Libya', 'Libya'), ('Indian/Comoro', 'Indian/Comoro'), ('Europe/Paris', 'Europe/Paris'), ('America/Adak', 'America/Adak'), ('Etc/GMT+2', 'Etc/GMT+2'), ('Africa/Lubumbashi', 'Africa/Lubumbashi'), ('Europe/Zaporozhye', 'Europe/Zaporozhye'), ('America/Caracas', 'America/Caracas'), ('Etc/GMT-7', 'Etc/GMT-7'), ('Africa/Kinshasa', 'Africa/Kinshasa'), ('Australia/West', 'Australia/West'), ('Singapore', 'Singapore'), ('Australia/North', 'Australia/North'), ('Australia/Perth', 'Australia/Perth'), ('Africa/Banjul', 'Africa/Banjul'), ('Canada/Yukon', 'Canada/Yukon'), ('Asia/Harbin', 'Asia/Harbin'), ('Pacific/Palau', 'Pacific/Palau'), ('Africa/Porto-Novo', 'Africa/Porto-Novo'), ('Pacific/Kwajalein', 'Pacific/Kwajalein'), ('America/Chihuahua', 'America/Chihuahua'), ('Africa/Djibouti', 'Africa/Djibouti'), ('America/Port_of_Spain', 'America/Port_of_Spain'), ('Africa/Cairo', 'Africa/Cairo'), ('Europe/Sofia', 'Europe/Sofia'), ('America/El_Salvador', 'America/El_Salvador'), ('Iceland', 'Iceland'), ('America/Tijuana', 'America/Tijuana'), ('America/Kentucky/Monticello', 'America/Kentucky/Monticello'), ('Asia/Pyongyang', 'Asia/Pyongyang'), ('Egypt', 'Egypt'), ('Atlantic/Jan_Mayen', 'Atlantic/Jan_Mayen'), ('Brazil/West', 'Brazil/West'), ('Africa/Bujumbura', 'Africa/Bujumbura'), ('PST8PDT', 'PST8PDT'), ('Asia/Saigon', 'Asia/Saigon'), ('America/Resolute', 'America/Resolute'), ('America/North_Dakota/Center', 'America/North_Dakota/Center'), ('Etc/GMT-0', 'Etc/GMT-0'), ('America/North_Dakota/New_Salem', 'America/North_Dakota/New_Salem'), ('HST', 'HST'), ('America/St_Barthelemy', 'America/St_Barthelemy'), ('Europe/Chisinau', 'Europe/Chisinau'), ('Etc/GMT-4', 'Etc/GMT-4'), ('America/Guatemala', 'America/Guatemala'), ('Africa/Ouagadougou', 'Africa/Ouagadougou'), ('America/Montserrat', 'America/Montserrat'), ('Pacific/Chatham', 'Pacific/Chatham'), ('Atlantic/Madeira', 'Atlantic/Madeira'), ('America/La_Paz', 'America/La_Paz'), ('US/Samoa', 'US/Samoa'), ('Pacific/Gambier', 'Pacific/Gambier'), ('Etc/GMT-9', 'Etc/GMT-9'), ('Asia/Khandyga', 'Asia/Khandyga'), ('Greenwich', 'Greenwich'), ('US/Pacific', 'US/Pacific'), ('America/Cuiaba', 'America/Cuiaba'), ('US/Indiana-Starke', 'US/Indiana-Starke'), ('Europe/Prague', 'Europe/Prague'), ('Europe/Isle_of_Man', 'Europe/Isle_of_Man'), ('America/Rankin_Inlet', 'America/Rankin_Inlet'), ('America/Goose_Bay', 'America/Goose_Bay'), ('Etc/GMT-13', 'Etc/GMT-13'), ('Etc/GMT+6', 'Etc/GMT+6'), ('America/Yakutat', 'America/Yakutat'), ('Poland', 'Poland'), ('Asia/Seoul', 'Asia/Seoul'), ('Europe/Madrid', 'Europe/Madrid'), ('Europe/Lisbon', 'Europe/Lisbon'), ('America/Grand_Turk', 'America/Grand_Turk'), ('EET', 'EET'), ('America/Coral_Harbour', 'America/Coral_Harbour'), ('Asia/Calcutta', 'Asia/Calcutta'), ('Asia/Famagusta', 'Asia/Famagusta'), ('Asia/Aqtau', 'Asia/Aqtau'), ('Europe/Helsinki', 'Europe/Helsinki'), ('Africa/Abidjan', 'Africa/Abidjan'), ('Asia/Riyadh', 'Asia/Riyadh'), ('America/Cayman', 'America/Cayman'), ('Europe/Samara', 'Europe/Samara'), ('America/Guayaquil', 'America/Guayaquil'), ('Asia/Gaza', 'Asia/Gaza'), ('Asia/Baghdad', 'Asia/Baghdad'), ('US/Arizona', 'US/Arizona'), ('Asia/Dubai', 'Asia/Dubai'), ('Asia/Kolkata', 'Asia/Kolkata'), ('America/Buenos_Aires', 'America/Buenos_Aires'), ('Asia/Krasnoyarsk', 'Asia/Krasnoyarsk'), ('America/Boa_Vista', 'America/Boa_Vista'), ('Pacific/Ponape', 'Pacific/Ponape'), ('Asia/Qostanay', 'Asia/Qostanay'), ('Asia/Bangkok', 'Asia/Bangkok'), ('America/Knox_IN', 'America/Knox_IN'), ('Asia/Choibalsan', 'Asia/Choibalsan'), ('Africa/Brazzaville', 'Africa/Brazzaville'), ('Asia/Phnom_Penh', 'Asia/Phnom_Penh'), ('America/Thunder_Bay', 'America/Thunder_Bay'), ('America/Indiana/Vincennes', 'America/Indiana/Vincennes'), ('Europe/Mariehamn', 'Europe/Mariehamn'), ('America/Panama', 'America/Panama'), ('America/Edmonton', 'America/Edmonton'), ('America/Matamoros', 'America/Matamoros'), ('Asia/Vientiane', 'Asia/Vientiane'), ('Africa/Lusaka', 'Africa/Lusaka'), ('Africa/Mbabane', 'Africa/Mbabane'), ('America/Cayenne', 'America/Cayenne'), ('Pacific/Tongatapu', 'Pacific/Tongatapu'), ('America/Indianapolis', 'America/Indianapolis'), ('Etc/GMT+10', 'Etc/GMT+10'), ('Asia/Kamchatka', 'Asia/Kamchatka'), ('America/Anguilla', 'America/Anguilla'), ('America/Blanc-Sablon', 'America/Blanc-Sablon'), ('CET', 'CET'), ('Europe/Podgorica', 'Europe/Podgorica'), ('America/Aruba', 'America/Aruba'), ('America/Atka', 'America/Atka'), ('Asia/Tashkent', 'Asia/Tashkent'), ('Canada/Eastern', 'Canada/Eastern'), ('Indian/Cocos', 'Indian/Cocos'), ('America/Tortola', 'America/Tortola'), ('Asia/Kuching', 'Asia/Kuching'), ('Etc/GMT+9', 'Etc/GMT+9'), ('Etc/Greenwich', 'Etc/Greenwich'), ('Pacific/Niue', 'Pacific/Niue'), + ('Pacific/Guadalcanal', 'Pacific/Guadalcanal'), ('Pacific/Honolulu', 'Pacific/Honolulu'), ('Europe/Volgograd', 'Europe/Volgograd'), ('Asia/Kabul', 'Asia/Kabul'), ('Etc/GMT-12', 'Etc/GMT-12'), ('Asia/Macau', 'Asia/Macau'), ('Australia/Eucla', 'Australia/Eucla'), ('America/Nuuk', 'America/Nuuk'), ('Indian/Antananarivo', 'Indian/Antananarivo'), ('Africa/El_Aaiun', 'Africa/El_Aaiun'), ('Etc/GMT-5', 'Etc/GMT-5'), ('Asia/Yekaterinburg', 'Asia/Yekaterinburg'), ('Australia/South', 'Australia/South'), ('Australia/Yancowinna', 'Australia/Yancowinna'), ('Australia/Hobart', 'Australia/Hobart'), ('Etc/GMT-10', 'Etc/GMT-10'), ('Africa/Luanda', 'Africa/Luanda'), ('Asia/Muscat', 'Asia/Muscat'), ('Pacific/Pohnpei', 'Pacific/Pohnpei'), ('Asia/Jayapura', 'Asia/Jayapura'), ('America/Noronha', 'America/Noronha'), ('Europe/Luxembourg', 'Europe/Luxembourg'), ('Australia/Broken_Hill', 'Australia/Broken_Hill'), ('Africa/Lagos', 'Africa/Lagos'), ('America/Ensenada', 'America/Ensenada'), ('Australia/Queensland', 'Australia/Queensland'), ('America/New_York', 'America/New_York'), ('Etc/GMT-11', 'Etc/GMT-11'), ('America/Louisville', 'America/Louisville'), ('America/Inuvik', 'America/Inuvik'), ('Australia/Tasmania', 'Australia/Tasmania'), ('Europe/Tallinn', 'Europe/Tallinn'), ('Asia/Tomsk', 'Asia/Tomsk'), ('America/Paramaribo', 'America/Paramaribo'), ('Asia/Tokyo', 'Asia/Tokyo'), ('Africa/Kampala', 'Africa/Kampala'), ('UCT', 'UCT'), ('Europe/Monaco', 'Europe/Monaco'), ('America/Nipigon', 'America/Nipigon'), ('Africa/Nairobi', 'Africa/Nairobi'), ('Pacific/Wake', 'Pacific/Wake'), ('America/Argentina/Rio_Gallegos', 'America/Argentina/Rio_Gallegos'), ('Europe/Warsaw', 'Europe/Warsaw'), ('Europe/Berlin', 'Europe/Berlin'), ('Atlantic/Reykjavik', 'Atlantic/Reykjavik'), ('Europe/Brussels', 'Europe/Brussels'), ('America/Scoresbysund', 'America/Scoresbysund'), ('America/Winnipeg', 'America/Winnipeg'), ('Asia/Bahrain', 'Asia/Bahrain'), ('Asia/Jakarta', 'Asia/Jakarta'), ('Etc/GMT-8', 'Etc/GMT-8'), ('America/Detroit', 'America/Detroit'), ('America/Juneau', 'America/Juneau'), ('Africa/Gaborone', 'Africa/Gaborone'), ('America/St_Lucia', 'America/St_Lucia'), ('Asia/Nicosia', 'Asia/Nicosia'), ('Africa/Khartoum', 'Africa/Khartoum'), ('Indian/Mauritius', 'Indian/Mauritius'), ('Africa/Mogadishu', 'Africa/Mogadishu'), ('Europe/Moscow', 'Europe/Moscow'), ('America/Ojinaga', 'America/Ojinaga'), ('Universal', 'Universal'), ('Europe/Kiev', 'Europe/Kiev'), ('Asia/Manila', 'Asia/Manila'), ('Pacific/Funafuti', 'Pacific/Funafuti'), ('America/Indiana/Winamac', 'America/Indiana/Winamac'), ('Africa/Freetown', 'Africa/Freetown'), ('Etc/Zulu', 'Etc/Zulu'), ('Europe/Budapest', 'Europe/Budapest'), ('Europe/Gibraltar', 'Europe/Gibraltar'), ('Europe/Nicosia', 'Europe/Nicosia'), ('Europe/Simferopol', 'Europe/Simferopol'), ('Asia/Qyzylorda', 'Asia/Qyzylorda'), ('America/Punta_Arenas', 'America/Punta_Arenas'), ('GMT0', 'GMT0'), ('Europe/Saratov', 'Europe/Saratov'), ('Asia/Kashgar', 'Asia/Kashgar'), ('Asia/Amman', 'Asia/Amman'), ('Pacific/Kiritimati', 'Pacific/Kiritimati'), ('Indian/Kerguelen', 'Indian/Kerguelen'), ('Pacific/Bougainville', 'Pacific/Bougainville'), ('Australia/Darwin', 'Australia/Darwin'), ('US/Aleutian', 'US/Aleutian'), ('Africa/Algiers', 'Africa/Algiers'), ('Australia/Canberra', 'Australia/Canberra'), ('Australia/Currie', 'Australia/Currie'), ('Asia/Dacca', 'Asia/Dacca'), ('America/Bahia', 'America/Bahia'), ('Asia/Aqtobe', 'Asia/Aqtobe'), ('Asia/Beirut', 'Asia/Beirut'), ('CST6CDT', 'CST6CDT'), ('US/East-Indiana', 'US/East-Indiana'), ('Australia/Lord_Howe', 'Australia/Lord_Howe'), ('Asia/Anadyr', 'Asia/Anadyr'), ('Pacific/Yap', 'Pacific/Yap'), ('Europe/Rome', 'Europe/Rome'), ('Etc/GMT-3', 'Etc/GMT-3'), ('Africa/Ndjamena', 'Africa/Ndjamena'), ('America/St_Thomas', 'America/St_Thomas'), ('Turkey', 'Turkey'), ('Asia/Yakutsk', 'Asia/Yakutsk'), ('America/Hermosillo', 'America/Hermosillo'), ('America/Argentina/Ushuaia', 'America/Argentina/Ushuaia'), ('Australia/LHI', 'Australia/LHI'), ('Africa/Johannesburg', 'Africa/Johannesburg'), ('Etc/GMT+1', 'Etc/GMT+1'), ('Australia/Brisbane', 'Australia/Brisbane'), ('America/Virgin', 'America/Virgin'), ('Asia/Kathmandu', 'Asia/Kathmandu'), ('Pacific/Pago_Pago', 'Pacific/Pago_Pago'), ('Pacific/Marquesas', 'Pacific/Marquesas'), ('Asia/Aden', 'Asia/Aden'), ('Etc/GMT+8', 'Etc/GMT+8'), ('Europe/Amsterdam', 'Europe/Amsterdam'), ('Africa/Asmera', 'Africa/Asmera'), ('Mexico/General', 'Mexico/General'), ('Atlantic/Faroe', 'Atlantic/Faroe'), ('America/Swift_Current', 'America/Swift_Current'), ('America/Catamarca', 'America/Catamarca'), ('Etc/GMT+11', 'Etc/GMT+11'), ('Pacific/Majuro', 'Pacific/Majuro'), ('GMT', 'GMT'), ('Europe/Vienna', 'Europe/Vienna'), ('MST7MDT', 'MST7MDT'), ('Indian/Maldives', 'Indian/Maldives'), ('Asia/Qatar', 'Asia/Qatar'), ('Asia/Istanbul', 'Asia/Istanbul'), ('Chile/Continental', 'Chile/Continental'), ('America/Fortaleza', 'America/Fortaleza'), ('Etc/GMT+7', 'Etc/GMT+7'), ('Australia/Victoria', 'Australia/Victoria'), ('Asia/Damascus', 'Asia/Damascus'), ('America/St_Kitts', 'America/St_Kitts'), ('America/Argentina/Buenos_Aires', 'America/Argentina/Buenos_Aires'), ('America/Barbados', 'America/Barbados'), ('America/St_Vincent', 'America/St_Vincent'), ('Indian/Christmas', 'Indian/Christmas'), ('America/Los_Angeles', 'America/Los_Angeles'), ('Antarctica/Casey', 'Antarctica/Casey'), ('Asia/Brunei', 'Asia/Brunei'), ('Asia/Srednekolymsk', 'Asia/Srednekolymsk'), ('Atlantic/South_Georgia', 'Atlantic/South_Georgia'), ('Mexico/BajaNorte', 'Mexico/BajaNorte'), ('Africa/Niamey', 'Africa/Niamey'), ('America/Campo_Grande', 'America/Campo_Grande'), ('Israel', 'Israel'), ('Africa/Monrovia', 'Africa/Monrovia'), ('EST5EDT', 'EST5EDT'), ('Jamaica', 'Jamaica'), ('Africa/Maputo', 'Africa/Maputo'), ('Etc/GMT+3', 'Etc/GMT+3'), ('Africa/Addis_Ababa', 'Africa/Addis_Ababa'), ('Pacific/Port_Moresby', 'Pacific/Port_Moresby'), ('EST', 'EST'), ('Antarctica/Macquarie', 'Antarctica/Macquarie'), ('GMT-0', 'GMT-0'), ('Brazil/East', 'Brazil/East'), ('America/Porto_Acre', 'America/Porto_Acre'), ('US/Michigan', 'US/Michigan'), ('Pacific/Kanton', 'Pacific/Kanton'), ('Zulu', 'Zulu'), ('Indian/Reunion', 'Indian/Reunion'), ('Etc/GMT', 'Etc/GMT'), ('Indian/Chagos', 'Indian/Chagos'), ('America/Curacao', 'America/Curacao'), ('Europe/Dublin', 'Europe/Dublin'), ('Asia/Irkutsk', 'Asia/Irkutsk'), ('Asia/Shanghai', 'Asia/Shanghai'), ('America/Monterrey', 'America/Monterrey'), ('America/Dawson', 'America/Dawson'), ('Canada/Newfoundland', 'Canada/Newfoundland'), ('America/Indiana/Vevay', 'America/Indiana/Vevay'), ('Pacific/Truk', 'Pacific/Truk'), ('America/Cambridge_Bay', 'America/Cambridge_Bay'), ('America/Bahia_Banderas', 'America/Bahia_Banderas'), ('Etc/UTC', 'Etc/UTC'), ('America/Sitka', 'America/Sitka'), ('Etc/GMT-2', 'Etc/GMT-2'), ('America/Grenada', 'America/Grenada'), ('Europe/Jersey', 'Europe/Jersey'), ('Asia/Baku', 'Asia/Baku'), ('Canada/Pacific', 'Canada/Pacific'), ('America/Pangnirtung', 'America/Pangnirtung'), ('America/Santarem', 'America/Santarem'), ('Pacific/Efate', 'Pacific/Efate'), ('America/Argentina/Jujuy', 'America/Argentina/Jujuy'), ('US/Mountain', 'US/Mountain'), ('Africa/Dar_es_Salaam', 'Africa/Dar_es_Salaam'), ('Europe/Kyiv', 'Europe/Kyiv'), ('Australia/Sydney', 'Australia/Sydney'), ('Europe/Kirov', 'Europe/Kirov'), ('Asia/Chita', 'Asia/Chita'), ('America/Argentina/La_Rioja', 'America/Argentina/La_Rioja'), ('Pacific/Tahiti', 'Pacific/Tahiti'), ('Australia/Lindeman', 'Australia/Lindeman'), ('Antarctica/Troll', 'Antarctica/Troll'), ('Europe/Busingen', 'Europe/Busingen'), ('Pacific/Noumea', 'Pacific/Noumea'), ('America/Danmarkshavn', 'America/Danmarkshavn'), ('Africa/Douala', 'Africa/Douala'), ('Pacific/Enderbury', 'Pacific/Enderbury'), ('GB', 'GB'), ('Asia/Kuala_Lumpur', 'Asia/Kuala_Lumpur'), ('Europe/Sarajevo', 'Europe/Sarajevo'), ('Asia/Atyrau', 'Asia/Atyrau'), ('Africa/Lome', 'Africa/Lome'), ('Asia/Hebron', 'Asia/Hebron'), ('WET', 'WET'), ('America/Costa_Rica', 'America/Costa_Rica'), ('America/Anchorage', 'America/Anchorage'), ('US/Hawaii', 'US/Hawaii'), ('Europe/London', 'Europe/London'), ('Atlantic/Cape_Verde', 'Atlantic/Cape_Verde'), ('Europe/Vaduz', 'Europe/Vaduz'), ('Asia/Ho_Chi_Minh', 'Asia/Ho_Chi_Minh'), ('America/Kentucky/Louisville', 'America/Kentucky/Louisville'), ('Australia/NSW', 'Australia/NSW'), ('Europe/Oslo', 'Europe/Oslo'), ('Antarctica/DumontDUrville', 'Antarctica/DumontDUrville'), ('Etc/GMT+12', 'Etc/GMT+12'), ('Atlantic/St_Helena', 'Atlantic/St_Helena'), ('Pacific/Easter', 'Pacific/Easter'), ('Brazil/DeNoronha', 'Brazil/DeNoronha'), ('America/Montevideo', 'America/Montevideo'), ('Europe/Athens', 'Europe/Athens'), ('Africa/Tunis', 'Africa/Tunis'), ('Hongkong', 'Hongkong'), ('Etc/GMT+4', 'Etc/GMT+4'), ('Kwajalein', 'Kwajalein'), ('America/Indiana/Petersburg', 'America/Indiana/Petersburg'), ('America/St_Johns', 'America/St_Johns'), ('Etc/GMT+0', 'Etc/GMT+0'), ('Antarctica/Davis', 'Antarctica/Davis'), ('America/Indiana/Tell_City', 'America/Indiana/Tell_City'), ('Pacific/Samoa', 'Pacific/Samoa'), ('America/Guyana', 'America/Guyana'), ('Mexico/BajaSur', 'Mexico/BajaSur'), ('Asia/Ulaanbaatar', 'Asia/Ulaanbaatar'), ('Etc/UCT', 'Etc/UCT'), ('America/Godthab', 'America/Godthab'), ('Asia/Tbilisi', 'Asia/Tbilisi'), ('Etc/GMT-1', 'Etc/GMT-1'), ('Asia/Kuwait', 'Asia/Kuwait'), ('Atlantic/Bermuda', 'Atlantic/Bermuda'), ('Pacific/Galapagos', 'Pacific/Galapagos'), ('Antarctica/Syowa', 'Antarctica/Syowa'), ('GMT+0', 'GMT+0'), ('Antarctica/South_Pole', 'Antarctica/South_Pole'), ('Asia/Novokuznetsk', 'Asia/Novokuznetsk'), ('Iran', 'Iran'), ('Europe/Vilnius', 'Europe/Vilnius'), ('Europe/Belgrade', 'Europe/Belgrade'), ('Europe/Tiraspol', 'Europe/Tiraspol'), ('Asia/Tehran', 'Asia/Tehran'), ('Asia/Magadan', 'Asia/Magadan'), ('America/Managua', 'America/Managua'), ('Pacific/Midway', 'Pacific/Midway'), ('Indian/Mayotte', 'Indian/Mayotte'), ('MST', 'MST'), ('Europe/Belfast', 'Europe/Belfast'), ('Arctic/Longyearbyen', 'Arctic/Longyearbyen'), ('Asia/Hovd', 'Asia/Hovd'), ('Navajo', 'Navajo'), ('Africa/Nouakchott', 'Africa/Nouakchott'), ('Asia/Omsk', 'Asia/Omsk'), ('America/Martinique', 'America/Martinique'), ('Asia/Ulan_Bator', 'Asia/Ulan_Bator'), ('Canada/Mountain', 'Canada/Mountain'), ('America/Sao_Paulo', 'America/Sao_Paulo'), ('Africa/Conakry', 'Africa/Conakry'), ('America/Atikokan', 'America/Atikokan'), ('Africa/Libreville', 'Africa/Libreville'), ('Asia/Katmandu', 'Asia/Katmandu'), ('Africa/Juba', 'Africa/Juba'), ('Europe/Ulyanovsk', 'Europe/Ulyanovsk'), ('America/Argentina/Salta', 'America/Argentina/Salta'), ('America/Rosario', 'America/Rosario'), ('America/Araguaina', 'America/Araguaina'), ('Etc/GMT+5', 'Etc/GMT+5'), ('America/Belem', 'America/Belem'), ('America/Menominee', 'America/Menominee'), ('Pacific/Apia', 'Pacific/Apia'), ('Asia/Makassar', 'Asia/Makassar'), ('Pacific/Fiji', 'Pacific/Fiji'), ('America/Denver', 'America/Denver'), ('America/Moncton', 'America/Moncton'), ('America/Regina', 'America/Regina'), ('Asia/Ujung_Pandang', 'Asia/Ujung_Pandang'), ('Asia/Vladivostok', 'Asia/Vladivostok'), ('America/Belize', 'America/Belize'), ('Pacific/Tarawa', 'Pacific/Tarawa'), ('America/Indiana/Knox', 'America/Indiana/Knox'), ('America/Whitehorse', 'America/Whitehorse'), ('US/Alaska', 'US/Alaska'), ('Asia/Bishkek', 'Asia/Bishkek'), ('Europe/Istanbul', 'Europe/Istanbul'), ('ROC', 'ROC'), ('America/Nassau', 'America/Nassau'), ('UTC', 'UTC'), ('America/Santiago', 'America/Santiago')], default='Europe/London', max_length=35), + ), + ] diff --git a/OneSila/core/tests/__init__.py b/OneSila/core/tests/__init__.py index b505afc8..8be5d47a 100644 --- a/OneSila/core/tests/__init__.py +++ b/OneSila/core/tests/__init__.py @@ -1,9 +1,14 @@ from core.models import MultiTenantCompany from django.contrib.auth import get_user_model from model_bakery import baker +from django.test import TestCase as DjangoTestCase class TestCaseMixin: def setUp(self): self.multi_tenant_company = baker.make(MultiTenantCompany) self.user = baker.make(get_user_model(), multi_tenant_company=self.multi_tenant_company) + + +class TestCase(TestCaseMixin, DjangoTestCase): + pass diff --git a/OneSila/inventory/migrations/0002_alter_inventory_options.py b/OneSila/inventory/migrations/0002_alter_inventory_options.py new file mode 100644 index 00000000..d39fa1c0 --- /dev/null +++ b/OneSila/inventory/migrations/0002_alter_inventory_options.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.6 on 2024-01-02 11:06 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('inventory', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='inventory', + options={'verbose_name_plural': 'inventories'}, + ), + ] diff --git a/OneSila/media/helpers.py b/OneSila/media/helpers.py index eb17c823..603ce073 100644 --- a/OneSila/media/helpers.py +++ b/OneSila/media/helpers.py @@ -15,15 +15,6 @@ def sanitize_media_filename(filename): return filename -def get_media_folder_upload_path(instance, filename): - '''Return a dynmic path based on the selection location. And clean the filename''' - path = os.path.join('media_files/', instance.image_location.path, sanitize_media_filename(filename)) - - logger.debug("Upload path {}".format(path)) - - return path - - def is_landscape(w, h): ''' Returns True if image is landscape diff --git a/OneSila/media/image_specs.py b/OneSila/media/image_specs.py index 275b39ff..031fe6d1 100644 --- a/OneSila/media/image_specs.py +++ b/OneSila/media/image_specs.py @@ -2,6 +2,8 @@ from imagekit.processors import ResizeToFill, ResizeToFit from imagekit.utils import get_field_info +import os + class ImageWebSpec(ImageSpec): ''' diff --git a/OneSila/media/migrations/0001_initial.py b/OneSila/media/migrations/0001_initial.py index 0993e843..14b79153 100644 --- a/OneSila/media/migrations/0001_initial.py +++ b/OneSila/media/migrations/0001_initial.py @@ -2,8 +2,7 @@ from django.db import migrations, models import django.db.models.deletion -import media.helpers -import media.validators +import core.validators class Migration(migrations.Migration): @@ -25,8 +24,8 @@ class Migration(migrations.Migration): ('type', models.CharField(choices=[('IMAGE', 'Image'), ('VIDEO', 'Video')], max_length=5)), ('video_url', models.URLField()), ('image_type', models.CharField(choices=[('MOOD', 'Mood Shot'), ('PACK', 'Pack Shot')], default='PACK', max_length=4)), - ('image', models.ImageField(upload_to=media.helpers.get_media_folder_upload_path, validators=[ - media.validators.validate_image_extension], verbose_name='Image (High resolution)')), + ('image', models.ImageField(upload_to='images/', validators=[ + core.validators.validate_image_extension], verbose_name='Image (High resolution)')), ('multi_tenant_company', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.multitenantcompany')), ], options={ diff --git a/OneSila/media/migrations/0002_alter_media_image.py b/OneSila/media/migrations/0002_alter_media_image.py new file mode 100644 index 00000000..8d5c57c6 --- /dev/null +++ b/OneSila/media/migrations/0002_alter_media_image.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.6 on 2024-01-02 11:06 + +import core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('media', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='media', + name='image', + field=models.ImageField(upload_to='images/', validators=[core.validators.validate_image_extension, + core.validators.no_dots_in_filename], verbose_name='Image (High resolution)'), + ), + ] diff --git a/OneSila/media/models.py b/OneSila/media/models.py index 539f9260..e18f2634 100644 --- a/OneSila/media/models.py +++ b/OneSila/media/models.py @@ -5,8 +5,9 @@ from imagekit.models import ImageSpecField from imagekit.processors import ResizeToFill, ResizeToFit -from .validators import no_dots_in_filename, validate_image_extension -from .helpers import get_media_folder_upload_path, is_landscape +from get_absolute_url.helpers import generate_absolute_url + +from core.validators import no_dots_in_filename, validate_image_extension from .image_specs import ImageWebSpec from .managers import ImageManager, VideoManager @@ -44,15 +45,12 @@ class Media(models.Model): image_type = models.CharField(max_length=4, choices=IMAGE_TYPE_CHOICES, default=PACK_SHOT) image = models.ImageField(_('Image (High resolution)'), - upload_to=get_media_folder_upload_path, validators=[validate_image_extension]) + upload_to='images/', validators=[validate_image_extension, no_dots_in_filename]) image_web = ImageSpecField(source='image', id='mediapp:image:imagewebspec') products = models.ManyToManyField('products.Product', through='MediaProductThrough') - # symmetrical=False, - # blank=True, - # related_name='bundles') objects = models.Manager() videos = VideoManager() @@ -62,17 +60,11 @@ class Media(models.Model): def image_web_size(self): return self.image_web.file.image_web.size - def __str__(self): - return self.image.name - - def __url__(self): - from django.conf import settings + def image_web_url(self): + if self.image: + return f"{generate_absolute_url(trailing_slash=False)}{self.image_web.url}" - url = 'https://{}{}{}'.format( - settings.DOMAIN_PRODUCTION[-1], # Not sure how to identify the current host. So take the production one for now. - settings.MEDIA_URL, - self.image.name) - return url + return None class Image(Media): diff --git a/OneSila/media/schema/types/types.py b/OneSila/media/schema/types/types.py index 2674599d..78968356 100644 --- a/OneSila/media/schema/types/types.py +++ b/OneSila/media/schema/types/types.py @@ -1,4 +1,5 @@ from core.schema.core.types.types import relay, type, GetQuerysetMultiTenantMixin +from strawberry_django.fields.types import DjangoImageType from typing import List @@ -11,12 +12,14 @@ @type(Media, filters=MediaFilter, order=MediaOrder, pagination=True, fields="__all__") class MediaType(relay.Node, GetQuerysetMultiTenantMixin): - pass + image_web: DjangoImageType | None + image_web_url: str | None @type(Image, filters=ImageFilter, order=ImageOrder, pagination=True, fields="__all__") class ImageType(relay.Node, GetQuerysetMultiTenantMixin): - pass + image_web: DjangoImageType | None + image_web_url: str | None @type(Video, filters=VideoFilter, order=VideoOrder, pagination=True, fields="__all__") diff --git a/OneSila/media/tests/tests_models.py b/OneSila/media/tests/tests_models.py index e69de29b..afc0b8bd 100644 --- a/OneSila/media/tests/tests_models.py +++ b/OneSila/media/tests/tests_models.py @@ -0,0 +1,28 @@ +from media.models import Media +from core.tests import TestCase +from model_bakery import baker +from django.core.files import File +from django.conf import settings +import os + + +class MediaTestCase(TestCase): + def test_image_web_url_none(self): + image = baker.make(Media, image=None) + url = image.image_web_url() + self.assertTrue(url is None) + + def test_image_web_url(self): + fname = 'red.png' + image_path = os.path.join(settings.BASE_DIR.parent, 'core', 'tests', 'image_files', fname) + image = baker.make(Media) + + with open(image_path, 'rb') as f: + image.image.save(fname, File(f)) + image.full_clean() + image.save() + url = image.image_web_url() + + # Cached images are converted to jpg, no matter what the source. + self.assertTrue(url.endswith('.jpg')) + self.assertTrue(url.startswith('http')) diff --git a/OneSila/media/validators.py b/OneSila/media/validators.py deleted file mode 100644 index 069b24e7..00000000 --- a/OneSila/media/validators.py +++ /dev/null @@ -1,19 +0,0 @@ -import os - -from django.utils.translation import gettext_lazy as _ -from django.core.exceptions import ValidationError - - -def validate_image_extension(value): - '''Validate if the upload has is a jpg or png image''' - ext = os.path.splitext(value.name)[1] - valid_extensions = ['.jpg'] - if not ext.lower() in valid_extensions: - raise ValidationError(_('Only {} are allowed.'.format(valid_extensions))) - - -def no_dots_in_filename(value): - ''' validate is a filename doesnt contain any dots''' - split = value.name.split('.') - if len(split) > 2: - raise ValidationError(_('No dots are allowed in the filename')) diff --git a/OneSila/sales_prices/factories/factories.py b/OneSila/sales_prices/factories/factories.py index 307c44e4..59572a32 100644 --- a/OneSila/sales_prices/factories/factories.py +++ b/OneSila/sales_prices/factories/factories.py @@ -5,7 +5,6 @@ from io import BytesIO from datetime import datetime from xlsxwriter.workbook import Workbook -import socket class SalesPriceListItemGeneratorUpdater: