From 71c65444014fb569ef12aac430b9f83f555b73c1 Mon Sep 17 00:00:00 2001 From: shagi Date: Fri, 8 Nov 2019 16:51:52 +0100 Subject: [PATCH] set on_delete on ForeignKeys, OneToOneFields and TreeForeignKeys --- account/migrations/0001_initial.py | 12 +- account/models.py | 12 +- general/migrations/0001_initial.py | 204 +-- general/migrations/0002_auto_20161130_1145.py | 106 +- general/migrations/0004_auto_20161201_1831.py | 4 +- general/models.py | 1572 ++++++++--------- validation/models.py | 4 +- valuenetwork/api/models.py | 4 +- .../migrations/0001_initial.py | 356 ++-- .../migrations/0002_auto_20160706_2026.py | 2 +- .../migrations/0005_auto_20161125_1138.py | 6 +- valuenetwork/valueaccounting/models.py | 364 ++-- work/migrations/0001_initial.py | 2 +- .../0006_project_skillsuggestion.py | 4 +- work/migrations/0008_joinrequest.py | 4 +- work/migrations/0010_auto_20160902_0436.py | 4 +- work/migrations/0013_auto_20160913_1301.py | 2 +- work/migrations/0016_auto_20161016_0937.py | 6 +- ...pe_ocp_nonmaterial_type_ocp_record_type.py | 16 +- work/migrations/0019_auto_20161207_1438.py | 2 +- work/migrations/0020_ocp_skill_type.py | 6 +- work/migrations/0021_ocp_artwork_type.py | 14 +- work/migrations/0023_auto_20170121_0004.py | 6 +- work/migrations/0024_ocp_unit_type.py | 6 +- work/migrations/0025_ocp_skill_type_facet.py | 2 +- .../0026_ocp_record_type_ocp_skill_type.py | 2 +- .../0027_ocp_artwork_type_unit_type.py | 2 +- work/models.py | 3 +- 28 files changed, 1364 insertions(+), 1363 deletions(-) diff --git a/account/migrations/0001_initial.py b/account/migrations/0001_initial.py index 7bba091f6..3556318e6 100644 --- a/account/migrations/0001_initial.py +++ b/account/migrations/0001_initial.py @@ -22,7 +22,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('timezone', account.fields.TimeZoneField(default=b'', max_length=100, verbose_name='timezone', blank=True, choices=[(b'Africa/Abidjan', b'Africa/Abidjan'), (b'Africa/Accra', b'Africa/Accra'), (b'Africa/Addis_Ababa', b'Africa/Addis_Ababa'), (b'Africa/Algiers', b'Africa/Algiers'), (b'Africa/Asmara', b'Africa/Asmara'), (b'Africa/Asmera', b'Africa/Asmera'), (b'Africa/Bamako', b'Africa/Bamako'), (b'Africa/Bangui', b'Africa/Bangui'), (b'Africa/Banjul', b'Africa/Banjul'), (b'Africa/Bissau', b'Africa/Bissau'), (b'Africa/Blantyre', b'Africa/Blantyre'), (b'Africa/Brazzaville', b'Africa/Brazzaville'), (b'Africa/Bujumbura', b'Africa/Bujumbura'), (b'Africa/Cairo', b'Africa/Cairo'), (b'Africa/Casablanca', b'Africa/Casablanca'), (b'Africa/Ceuta', b'Africa/Ceuta'), (b'Africa/Conakry', b'Africa/Conakry'), (b'Africa/Dakar', b'Africa/Dakar'), (b'Africa/Dar_es_Salaam', b'Africa/Dar_es_Salaam'), (b'Africa/Djibouti', b'Africa/Djibouti'), (b'Africa/Douala', b'Africa/Douala'), (b'Africa/El_Aaiun', b'Africa/El_Aaiun'), (b'Africa/Freetown', b'Africa/Freetown'), (b'Africa/Gaborone', b'Africa/Gaborone'), (b'Africa/Harare', b'Africa/Harare'), (b'Africa/Johannesburg', b'Africa/Johannesburg'), (b'Africa/Juba', b'Africa/Juba'), (b'Africa/Kampala', b'Africa/Kampala'), (b'Africa/Khartoum', b'Africa/Khartoum'), (b'Africa/Kigali', b'Africa/Kigali'), (b'Africa/Kinshasa', b'Africa/Kinshasa'), (b'Africa/Lagos', b'Africa/Lagos'), (b'Africa/Libreville', b'Africa/Libreville'), (b'Africa/Lome', b'Africa/Lome'), (b'Africa/Luanda', b'Africa/Luanda'), (b'Africa/Lubumbashi', b'Africa/Lubumbashi'), (b'Africa/Lusaka', b'Africa/Lusaka'), (b'Africa/Malabo', b'Africa/Malabo'), (b'Africa/Maputo', b'Africa/Maputo'), (b'Africa/Maseru', b'Africa/Maseru'), (b'Africa/Mbabane', b'Africa/Mbabane'), (b'Africa/Mogadishu', b'Africa/Mogadishu'), (b'Africa/Monrovia', b'Africa/Monrovia'), (b'Africa/Nairobi', b'Africa/Nairobi'), (b'Africa/Ndjamena', b'Africa/Ndjamena'), (b'Africa/Niamey', b'Africa/Niamey'), (b'Africa/Nouakchott', b'Africa/Nouakchott'), (b'Africa/Ouagadougou', b'Africa/Ouagadougou'), (b'Africa/Porto-Novo', b'Africa/Porto-Novo'), (b'Africa/Sao_Tome', b'Africa/Sao_Tome'), (b'Africa/Timbuktu', b'Africa/Timbuktu'), (b'Africa/Tripoli', b'Africa/Tripoli'), (b'Africa/Tunis', b'Africa/Tunis'), (b'Africa/Windhoek', b'Africa/Windhoek'), (b'America/Adak', b'America/Adak'), (b'America/Anchorage', b'America/Anchorage'), (b'America/Anguilla', b'America/Anguilla'), (b'America/Antigua', b'America/Antigua'), (b'America/Araguaina', b'America/Araguaina'), (b'America/Argentina/Buenos_Aires', b'America/Argentina/Buenos_Aires'), (b'America/Argentina/Catamarca', b'America/Argentina/Catamarca'), (b'America/Argentina/ComodRivadavia', b'America/Argentina/ComodRivadavia'), (b'America/Argentina/Cordoba', b'America/Argentina/Cordoba'), (b'America/Argentina/Jujuy', b'America/Argentina/Jujuy'), (b'America/Argentina/La_Rioja', b'America/Argentina/La_Rioja'), (b'America/Argentina/Mendoza', b'America/Argentina/Mendoza'), (b'America/Argentina/Rio_Gallegos', b'America/Argentina/Rio_Gallegos'), (b'America/Argentina/Salta', b'America/Argentina/Salta'), (b'America/Argentina/San_Juan', b'America/Argentina/San_Juan'), (b'America/Argentina/San_Luis', b'America/Argentina/San_Luis'), (b'America/Argentina/Tucuman', b'America/Argentina/Tucuman'), (b'America/Argentina/Ushuaia', b'America/Argentina/Ushuaia'), (b'America/Aruba', b'America/Aruba'), (b'America/Asuncion', b'America/Asuncion'), (b'America/Atikokan', b'America/Atikokan'), (b'America/Atka', b'America/Atka'), (b'America/Bahia', b'America/Bahia'), (b'America/Bahia_Banderas', b'America/Bahia_Banderas'), (b'America/Barbados', b'America/Barbados'), (b'America/Belem', b'America/Belem'), (b'America/Belize', b'America/Belize'), (b'America/Blanc-Sablon', b'America/Blanc-Sablon'), (b'America/Boa_Vista', b'America/Boa_Vista'), (b'America/Bogota', b'America/Bogota'), (b'America/Boise', b'America/Boise'), (b'America/Buenos_Aires', b'America/Buenos_Aires'), (b'America/Cambridge_Bay', b'America/Cambridge_Bay'), (b'America/Campo_Grande', b'America/Campo_Grande'), (b'America/Cancun', b'America/Cancun'), (b'America/Caracas', b'America/Caracas'), (b'America/Catamarca', b'America/Catamarca'), (b'America/Cayenne', b'America/Cayenne'), (b'America/Cayman', b'America/Cayman'), (b'America/Chicago', b'America/Chicago'), (b'America/Chihuahua', b'America/Chihuahua'), (b'America/Coral_Harbour', b'America/Coral_Harbour'), (b'America/Cordoba', b'America/Cordoba'), (b'America/Costa_Rica', b'America/Costa_Rica'), (b'America/Creston', b'America/Creston'), (b'America/Cuiaba', b'America/Cuiaba'), (b'America/Curacao', b'America/Curacao'), (b'America/Danmarkshavn', b'America/Danmarkshavn'), (b'America/Dawson', b'America/Dawson'), (b'America/Dawson_Creek', b'America/Dawson_Creek'), (b'America/Denver', b'America/Denver'), (b'America/Detroit', b'America/Detroit'), (b'America/Dominica', b'America/Dominica'), (b'America/Edmonton', b'America/Edmonton'), (b'America/Eirunepe', b'America/Eirunepe'), (b'America/El_Salvador', b'America/El_Salvador'), (b'America/Ensenada', b'America/Ensenada'), (b'America/Fort_Nelson', b'America/Fort_Nelson'), (b'America/Fort_Wayne', b'America/Fort_Wayne'), (b'America/Fortaleza', b'America/Fortaleza'), (b'America/Glace_Bay', b'America/Glace_Bay'), (b'America/Godthab', b'America/Godthab'), (b'America/Goose_Bay', b'America/Goose_Bay'), (b'America/Grand_Turk', b'America/Grand_Turk'), (b'America/Grenada', b'America/Grenada'), (b'America/Guadeloupe', b'America/Guadeloupe'), (b'America/Guatemala', b'America/Guatemala'), (b'America/Guayaquil', b'America/Guayaquil'), (b'America/Guyana', b'America/Guyana'), (b'America/Halifax', b'America/Halifax'), (b'America/Havana', b'America/Havana'), (b'America/Hermosillo', b'America/Hermosillo'), (b'America/Indiana/Indianapolis', b'America/Indiana/Indianapolis'), (b'America/Indiana/Knox', b'America/Indiana/Knox'), (b'America/Indiana/Marengo', b'America/Indiana/Marengo'), (b'America/Indiana/Petersburg', b'America/Indiana/Petersburg'), (b'America/Indiana/Tell_City', b'America/Indiana/Tell_City'), (b'America/Indiana/Vevay', b'America/Indiana/Vevay'), (b'America/Indiana/Vincennes', b'America/Indiana/Vincennes'), (b'America/Indiana/Winamac', b'America/Indiana/Winamac'), (b'America/Indianapolis', b'America/Indianapolis'), (b'America/Inuvik', b'America/Inuvik'), (b'America/Iqaluit', b'America/Iqaluit'), (b'America/Jamaica', b'America/Jamaica'), (b'America/Jujuy', b'America/Jujuy'), (b'America/Juneau', b'America/Juneau'), (b'America/Kentucky/Louisville', b'America/Kentucky/Louisville'), (b'America/Kentucky/Monticello', b'America/Kentucky/Monticello'), (b'America/Knox_IN', b'America/Knox_IN'), (b'America/Kralendijk', b'America/Kralendijk'), (b'America/La_Paz', b'America/La_Paz'), (b'America/Lima', b'America/Lima'), (b'America/Los_Angeles', b'America/Los_Angeles'), (b'America/Louisville', b'America/Louisville'), (b'America/Lower_Princes', b'America/Lower_Princes'), (b'America/Maceio', b'America/Maceio'), (b'America/Managua', b'America/Managua'), (b'America/Manaus', b'America/Manaus'), (b'America/Marigot', b'America/Marigot'), (b'America/Martinique', b'America/Martinique'), (b'America/Matamoros', b'America/Matamoros'), (b'America/Mazatlan', b'America/Mazatlan'), (b'America/Mendoza', b'America/Mendoza'), (b'America/Menominee', b'America/Menominee'), (b'America/Merida', b'America/Merida'), (b'America/Metlakatla', b'America/Metlakatla'), (b'America/Mexico_City', b'America/Mexico_City'), (b'America/Miquelon', b'America/Miquelon'), (b'America/Moncton', b'America/Moncton'), (b'America/Monterrey', b'America/Monterrey'), (b'America/Montevideo', b'America/Montevideo'), (b'America/Montreal', b'America/Montreal'), (b'America/Montserrat', b'America/Montserrat'), (b'America/Nassau', b'America/Nassau'), (b'America/New_York', b'America/New_York'), (b'America/Nipigon', b'America/Nipigon'), (b'America/Nome', b'America/Nome'), (b'America/Noronha', b'America/Noronha'), (b'America/North_Dakota/Beulah', b'America/North_Dakota/Beulah'), (b'America/North_Dakota/Center', b'America/North_Dakota/Center'), (b'America/North_Dakota/New_Salem', b'America/North_Dakota/New_Salem'), (b'America/Ojinaga', b'America/Ojinaga'), (b'America/Panama', b'America/Panama'), (b'America/Pangnirtung', b'America/Pangnirtung'), (b'America/Paramaribo', b'America/Paramaribo'), (b'America/Phoenix', b'America/Phoenix'), (b'America/Port-au-Prince', b'America/Port-au-Prince'), (b'America/Port_of_Spain', b'America/Port_of_Spain'), (b'America/Porto_Acre', b'America/Porto_Acre'), (b'America/Porto_Velho', b'America/Porto_Velho'), (b'America/Puerto_Rico', b'America/Puerto_Rico'), (b'America/Rainy_River', b'America/Rainy_River'), (b'America/Rankin_Inlet', b'America/Rankin_Inlet'), (b'America/Recife', b'America/Recife'), (b'America/Regina', b'America/Regina'), (b'America/Resolute', b'America/Resolute'), (b'America/Rio_Branco', b'America/Rio_Branco'), (b'America/Rosario', b'America/Rosario'), (b'America/Santa_Isabel', b'America/Santa_Isabel'), (b'America/Santarem', b'America/Santarem'), (b'America/Santiago', b'America/Santiago'), (b'America/Santo_Domingo', b'America/Santo_Domingo'), (b'America/Sao_Paulo', b'America/Sao_Paulo'), (b'America/Scoresbysund', b'America/Scoresbysund'), (b'America/Shiprock', b'America/Shiprock'), (b'America/Sitka', b'America/Sitka'), (b'America/St_Barthelemy', b'America/St_Barthelemy'), (b'America/St_Johns', b'America/St_Johns'), (b'America/St_Kitts', b'America/St_Kitts'), (b'America/St_Lucia', b'America/St_Lucia'), (b'America/St_Thomas', b'America/St_Thomas'), (b'America/St_Vincent', b'America/St_Vincent'), (b'America/Swift_Current', b'America/Swift_Current'), (b'America/Tegucigalpa', b'America/Tegucigalpa'), (b'America/Thule', b'America/Thule'), (b'America/Thunder_Bay', b'America/Thunder_Bay'), (b'America/Tijuana', b'America/Tijuana'), (b'America/Toronto', b'America/Toronto'), (b'America/Tortola', b'America/Tortola'), (b'America/Vancouver', b'America/Vancouver'), (b'America/Virgin', b'America/Virgin'), (b'America/Whitehorse', b'America/Whitehorse'), (b'America/Winnipeg', b'America/Winnipeg'), (b'America/Yakutat', b'America/Yakutat'), (b'America/Yellowknife', b'America/Yellowknife'), (b'Antarctica/Casey', b'Antarctica/Casey'), (b'Antarctica/Davis', b'Antarctica/Davis'), (b'Antarctica/DumontDUrville', b'Antarctica/DumontDUrville'), (b'Antarctica/Macquarie', b'Antarctica/Macquarie'), (b'Antarctica/Mawson', b'Antarctica/Mawson'), (b'Antarctica/McMurdo', b'Antarctica/McMurdo'), (b'Antarctica/Palmer', b'Antarctica/Palmer'), (b'Antarctica/Rothera', b'Antarctica/Rothera'), (b'Antarctica/South_Pole', b'Antarctica/South_Pole'), (b'Antarctica/Syowa', b'Antarctica/Syowa'), (b'Antarctica/Troll', b'Antarctica/Troll'), (b'Antarctica/Vostok', b'Antarctica/Vostok'), (b'Arctic/Longyearbyen', b'Arctic/Longyearbyen'), (b'Asia/Aden', b'Asia/Aden'), (b'Asia/Almaty', b'Asia/Almaty'), (b'Asia/Amman', b'Asia/Amman'), (b'Asia/Anadyr', b'Asia/Anadyr'), (b'Asia/Aqtau', b'Asia/Aqtau'), (b'Asia/Aqtobe', b'Asia/Aqtobe'), (b'Asia/Ashgabat', b'Asia/Ashgabat'), (b'Asia/Ashkhabad', b'Asia/Ashkhabad'), (b'Asia/Baghdad', b'Asia/Baghdad'), (b'Asia/Bahrain', b'Asia/Bahrain'), (b'Asia/Baku', b'Asia/Baku'), (b'Asia/Bangkok', b'Asia/Bangkok'), (b'Asia/Barnaul', b'Asia/Barnaul'), (b'Asia/Beirut', b'Asia/Beirut'), (b'Asia/Bishkek', b'Asia/Bishkek'), (b'Asia/Brunei', b'Asia/Brunei'), (b'Asia/Calcutta', b'Asia/Calcutta'), (b'Asia/Chita', b'Asia/Chita'), (b'Asia/Choibalsan', b'Asia/Choibalsan'), (b'Asia/Chongqing', b'Asia/Chongqing'), (b'Asia/Chungking', b'Asia/Chungking'), (b'Asia/Colombo', b'Asia/Colombo'), (b'Asia/Dacca', b'Asia/Dacca'), (b'Asia/Damascus', b'Asia/Damascus'), (b'Asia/Dhaka', b'Asia/Dhaka'), (b'Asia/Dili', b'Asia/Dili'), (b'Asia/Dubai', b'Asia/Dubai'), (b'Asia/Dushanbe', b'Asia/Dushanbe'), (b'Asia/Gaza', b'Asia/Gaza'), (b'Asia/Harbin', b'Asia/Harbin'), (b'Asia/Hebron', b'Asia/Hebron'), (b'Asia/Ho_Chi_Minh', b'Asia/Ho_Chi_Minh'), (b'Asia/Hong_Kong', b'Asia/Hong_Kong'), (b'Asia/Hovd', b'Asia/Hovd'), (b'Asia/Irkutsk', b'Asia/Irkutsk'), (b'Asia/Istanbul', b'Asia/Istanbul'), (b'Asia/Jakarta', b'Asia/Jakarta'), (b'Asia/Jayapura', b'Asia/Jayapura'), (b'Asia/Jerusalem', b'Asia/Jerusalem'), (b'Asia/Kabul', b'Asia/Kabul'), (b'Asia/Kamchatka', b'Asia/Kamchatka'), (b'Asia/Karachi', b'Asia/Karachi'), (b'Asia/Kashgar', b'Asia/Kashgar'), (b'Asia/Kathmandu', b'Asia/Kathmandu'), (b'Asia/Katmandu', b'Asia/Katmandu'), (b'Asia/Khandyga', b'Asia/Khandyga'), (b'Asia/Kolkata', b'Asia/Kolkata'), (b'Asia/Krasnoyarsk', b'Asia/Krasnoyarsk'), (b'Asia/Kuala_Lumpur', b'Asia/Kuala_Lumpur'), (b'Asia/Kuching', b'Asia/Kuching'), (b'Asia/Kuwait', b'Asia/Kuwait'), (b'Asia/Macao', b'Asia/Macao'), (b'Asia/Macau', b'Asia/Macau'), (b'Asia/Magadan', b'Asia/Magadan'), (b'Asia/Makassar', b'Asia/Makassar'), (b'Asia/Manila', b'Asia/Manila'), (b'Asia/Muscat', b'Asia/Muscat'), (b'Asia/Nicosia', b'Asia/Nicosia'), (b'Asia/Novokuznetsk', b'Asia/Novokuznetsk'), (b'Asia/Novosibirsk', b'Asia/Novosibirsk'), (b'Asia/Omsk', b'Asia/Omsk'), (b'Asia/Oral', b'Asia/Oral'), (b'Asia/Phnom_Penh', b'Asia/Phnom_Penh'), (b'Asia/Pontianak', b'Asia/Pontianak'), (b'Asia/Pyongyang', b'Asia/Pyongyang'), (b'Asia/Qatar', b'Asia/Qatar'), (b'Asia/Qyzylorda', b'Asia/Qyzylorda'), (b'Asia/Rangoon', b'Asia/Rangoon'), (b'Asia/Riyadh', b'Asia/Riyadh'), (b'Asia/Saigon', b'Asia/Saigon'), (b'Asia/Sakhalin', b'Asia/Sakhalin'), (b'Asia/Samarkand', b'Asia/Samarkand'), (b'Asia/Seoul', b'Asia/Seoul'), (b'Asia/Shanghai', b'Asia/Shanghai'), (b'Asia/Singapore', b'Asia/Singapore'), (b'Asia/Srednekolymsk', b'Asia/Srednekolymsk'), (b'Asia/Taipei', b'Asia/Taipei'), (b'Asia/Tashkent', b'Asia/Tashkent'), (b'Asia/Tbilisi', b'Asia/Tbilisi'), (b'Asia/Tehran', b'Asia/Tehran'), (b'Asia/Tel_Aviv', b'Asia/Tel_Aviv'), (b'Asia/Thimbu', b'Asia/Thimbu'), (b'Asia/Thimphu', b'Asia/Thimphu'), (b'Asia/Tokyo', b'Asia/Tokyo'), (b'Asia/Tomsk', b'Asia/Tomsk'), (b'Asia/Ujung_Pandang', b'Asia/Ujung_Pandang'), (b'Asia/Ulaanbaatar', b'Asia/Ulaanbaatar'), (b'Asia/Ulan_Bator', b'Asia/Ulan_Bator'), (b'Asia/Urumqi', b'Asia/Urumqi'), (b'Asia/Ust-Nera', b'Asia/Ust-Nera'), (b'Asia/Vientiane', b'Asia/Vientiane'), (b'Asia/Vladivostok', b'Asia/Vladivostok'), (b'Asia/Yakutsk', b'Asia/Yakutsk'), (b'Asia/Yekaterinburg', b'Asia/Yekaterinburg'), (b'Asia/Yerevan', b'Asia/Yerevan'), (b'Atlantic/Azores', b'Atlantic/Azores'), (b'Atlantic/Bermuda', b'Atlantic/Bermuda'), (b'Atlantic/Canary', b'Atlantic/Canary'), (b'Atlantic/Cape_Verde', b'Atlantic/Cape_Verde'), (b'Atlantic/Faeroe', b'Atlantic/Faeroe'), (b'Atlantic/Faroe', b'Atlantic/Faroe'), (b'Atlantic/Jan_Mayen', b'Atlantic/Jan_Mayen'), (b'Atlantic/Madeira', b'Atlantic/Madeira'), (b'Atlantic/Reykjavik', b'Atlantic/Reykjavik'), (b'Atlantic/South_Georgia', b'Atlantic/South_Georgia'), (b'Atlantic/St_Helena', b'Atlantic/St_Helena'), (b'Atlantic/Stanley', b'Atlantic/Stanley'), (b'Australia/ACT', b'Australia/ACT'), (b'Australia/Adelaide', b'Australia/Adelaide'), (b'Australia/Brisbane', b'Australia/Brisbane'), (b'Australia/Broken_Hill', b'Australia/Broken_Hill'), (b'Australia/Canberra', b'Australia/Canberra'), (b'Australia/Currie', b'Australia/Currie'), (b'Australia/Darwin', b'Australia/Darwin'), (b'Australia/Eucla', b'Australia/Eucla'), (b'Australia/Hobart', b'Australia/Hobart'), (b'Australia/LHI', b'Australia/LHI'), (b'Australia/Lindeman', b'Australia/Lindeman'), (b'Australia/Lord_Howe', b'Australia/Lord_Howe'), (b'Australia/Melbourne', b'Australia/Melbourne'), (b'Australia/NSW', b'Australia/NSW'), (b'Australia/North', b'Australia/North'), (b'Australia/Perth', b'Australia/Perth'), (b'Australia/Queensland', b'Australia/Queensland'), (b'Australia/South', b'Australia/South'), (b'Australia/Sydney', b'Australia/Sydney'), (b'Australia/Tasmania', b'Australia/Tasmania'), (b'Australia/Victoria', b'Australia/Victoria'), (b'Australia/West', b'Australia/West'), (b'Australia/Yancowinna', b'Australia/Yancowinna'), (b'Brazil/Acre', b'Brazil/Acre'), (b'Brazil/DeNoronha', b'Brazil/DeNoronha'), (b'Brazil/East', b'Brazil/East'), (b'Brazil/West', b'Brazil/West'), (b'CET', b'CET'), (b'CST6CDT', b'CST6CDT'), (b'Canada/Atlantic', b'Canada/Atlantic'), (b'Canada/Central', b'Canada/Central'), (b'Canada/East-Saskatchewan', b'Canada/East-Saskatchewan'), (b'Canada/Eastern', b'Canada/Eastern'), (b'Canada/Mountain', b'Canada/Mountain'), (b'Canada/Newfoundland', b'Canada/Newfoundland'), (b'Canada/Pacific', b'Canada/Pacific'), (b'Canada/Saskatchewan', b'Canada/Saskatchewan'), (b'Canada/Yukon', b'Canada/Yukon'), (b'Chile/Continental', b'Chile/Continental'), (b'Chile/EasterIsland', b'Chile/EasterIsland'), (b'Cuba', b'Cuba'), (b'EET', b'EET'), (b'EST', b'EST'), (b'EST5EDT', b'EST5EDT'), (b'Egypt', b'Egypt'), (b'Eire', b'Eire'), (b'Etc/GMT', b'Etc/GMT'), (b'Etc/GMT+0', b'Etc/GMT+0'), (b'Etc/GMT+1', b'Etc/GMT+1'), (b'Etc/GMT+10', b'Etc/GMT+10'), (b'Etc/GMT+11', b'Etc/GMT+11'), (b'Etc/GMT+12', b'Etc/GMT+12'), (b'Etc/GMT+2', b'Etc/GMT+2'), (b'Etc/GMT+3', b'Etc/GMT+3'), (b'Etc/GMT+4', b'Etc/GMT+4'), (b'Etc/GMT+5', b'Etc/GMT+5'), (b'Etc/GMT+6', b'Etc/GMT+6'), (b'Etc/GMT+7', b'Etc/GMT+7'), (b'Etc/GMT+8', b'Etc/GMT+8'), (b'Etc/GMT+9', b'Etc/GMT+9'), (b'Etc/GMT-0', b'Etc/GMT-0'), (b'Etc/GMT-1', b'Etc/GMT-1'), (b'Etc/GMT-10', b'Etc/GMT-10'), (b'Etc/GMT-11', b'Etc/GMT-11'), (b'Etc/GMT-12', b'Etc/GMT-12'), (b'Etc/GMT-13', b'Etc/GMT-13'), (b'Etc/GMT-14', b'Etc/GMT-14'), (b'Etc/GMT-2', b'Etc/GMT-2'), (b'Etc/GMT-3', b'Etc/GMT-3'), (b'Etc/GMT-4', b'Etc/GMT-4'), (b'Etc/GMT-5', b'Etc/GMT-5'), (b'Etc/GMT-6', b'Etc/GMT-6'), (b'Etc/GMT-7', b'Etc/GMT-7'), (b'Etc/GMT-8', b'Etc/GMT-8'), (b'Etc/GMT-9', b'Etc/GMT-9'), (b'Etc/GMT0', b'Etc/GMT0'), (b'Etc/Greenwich', b'Etc/Greenwich'), (b'Etc/UCT', b'Etc/UCT'), (b'Etc/UTC', b'Etc/UTC'), (b'Etc/Universal', b'Etc/Universal'), (b'Etc/Zulu', b'Etc/Zulu'), (b'Europe/Amsterdam', b'Europe/Amsterdam'), (b'Europe/Andorra', b'Europe/Andorra'), (b'Europe/Astrakhan', b'Europe/Astrakhan'), (b'Europe/Athens', b'Europe/Athens'), (b'Europe/Belfast', b'Europe/Belfast'), (b'Europe/Belgrade', b'Europe/Belgrade'), (b'Europe/Berlin', b'Europe/Berlin'), (b'Europe/Bratislava', b'Europe/Bratislava'), (b'Europe/Brussels', b'Europe/Brussels'), (b'Europe/Bucharest', b'Europe/Bucharest'), (b'Europe/Budapest', b'Europe/Budapest'), (b'Europe/Busingen', b'Europe/Busingen'), (b'Europe/Chisinau', b'Europe/Chisinau'), (b'Europe/Copenhagen', b'Europe/Copenhagen'), (b'Europe/Dublin', b'Europe/Dublin'), (b'Europe/Gibraltar', b'Europe/Gibraltar'), (b'Europe/Guernsey', b'Europe/Guernsey'), (b'Europe/Helsinki', b'Europe/Helsinki'), (b'Europe/Isle_of_Man', b'Europe/Isle_of_Man'), (b'Europe/Istanbul', b'Europe/Istanbul'), (b'Europe/Jersey', b'Europe/Jersey'), (b'Europe/Kaliningrad', b'Europe/Kaliningrad'), (b'Europe/Kiev', b'Europe/Kiev'), (b'Europe/Kirov', b'Europe/Kirov'), (b'Europe/Lisbon', b'Europe/Lisbon'), (b'Europe/Ljubljana', b'Europe/Ljubljana'), (b'Europe/London', b'Europe/London'), (b'Europe/Luxembourg', b'Europe/Luxembourg'), (b'Europe/Madrid', b'Europe/Madrid'), (b'Europe/Malta', b'Europe/Malta'), (b'Europe/Mariehamn', b'Europe/Mariehamn'), (b'Europe/Minsk', b'Europe/Minsk'), (b'Europe/Monaco', b'Europe/Monaco'), (b'Europe/Moscow', b'Europe/Moscow'), (b'Europe/Nicosia', b'Europe/Nicosia'), (b'Europe/Oslo', b'Europe/Oslo'), (b'Europe/Paris', b'Europe/Paris'), (b'Europe/Podgorica', b'Europe/Podgorica'), (b'Europe/Prague', b'Europe/Prague'), (b'Europe/Riga', b'Europe/Riga'), (b'Europe/Rome', b'Europe/Rome'), (b'Europe/Samara', b'Europe/Samara'), (b'Europe/San_Marino', b'Europe/San_Marino'), (b'Europe/Sarajevo', b'Europe/Sarajevo'), (b'Europe/Simferopol', b'Europe/Simferopol'), (b'Europe/Skopje', b'Europe/Skopje'), (b'Europe/Sofia', b'Europe/Sofia'), (b'Europe/Stockholm', b'Europe/Stockholm'), (b'Europe/Tallinn', b'Europe/Tallinn'), (b'Europe/Tirane', b'Europe/Tirane'), (b'Europe/Tiraspol', b'Europe/Tiraspol'), (b'Europe/Ulyanovsk', b'Europe/Ulyanovsk'), (b'Europe/Uzhgorod', b'Europe/Uzhgorod'), (b'Europe/Vaduz', b'Europe/Vaduz'), (b'Europe/Vatican', b'Europe/Vatican'), (b'Europe/Vienna', b'Europe/Vienna'), (b'Europe/Vilnius', b'Europe/Vilnius'), (b'Europe/Volgograd', b'Europe/Volgograd'), (b'Europe/Warsaw', b'Europe/Warsaw'), (b'Europe/Zagreb', b'Europe/Zagreb'), (b'Europe/Zaporozhye', b'Europe/Zaporozhye'), (b'Europe/Zurich', b'Europe/Zurich'), (b'GB', b'GB'), (b'GB-Eire', b'GB-Eire'), (b'GMT', b'GMT'), (b'GMT+0', b'GMT+0'), (b'GMT-0', b'GMT-0'), (b'GMT0', b'GMT0'), (b'Greenwich', b'Greenwich'), (b'HST', b'HST'), (b'Hongkong', b'Hongkong'), (b'Iceland', b'Iceland'), (b'Indian/Antananarivo', b'Indian/Antananarivo'), (b'Indian/Chagos', b'Indian/Chagos'), (b'Indian/Christmas', b'Indian/Christmas'), (b'Indian/Cocos', b'Indian/Cocos'), (b'Indian/Comoro', b'Indian/Comoro'), (b'Indian/Kerguelen', b'Indian/Kerguelen'), (b'Indian/Mahe', b'Indian/Mahe'), (b'Indian/Maldives', b'Indian/Maldives'), (b'Indian/Mauritius', b'Indian/Mauritius'), (b'Indian/Mayotte', b'Indian/Mayotte'), (b'Indian/Reunion', b'Indian/Reunion'), (b'Iran', b'Iran'), (b'Israel', b'Israel'), (b'Jamaica', b'Jamaica'), (b'Japan', b'Japan'), (b'Kwajalein', b'Kwajalein'), (b'Libya', b'Libya'), (b'MET', b'MET'), (b'MST', b'MST'), (b'MST7MDT', b'MST7MDT'), (b'Mexico/BajaNorte', b'Mexico/BajaNorte'), (b'Mexico/BajaSur', b'Mexico/BajaSur'), (b'Mexico/General', b'Mexico/General'), (b'NZ', b'NZ'), (b'NZ-CHAT', b'NZ-CHAT'), (b'Navajo', b'Navajo'), (b'PRC', b'PRC'), (b'PST8PDT', b'PST8PDT'), (b'Pacific/Apia', b'Pacific/Apia'), (b'Pacific/Auckland', b'Pacific/Auckland'), (b'Pacific/Bougainville', b'Pacific/Bougainville'), (b'Pacific/Chatham', b'Pacific/Chatham'), (b'Pacific/Chuuk', b'Pacific/Chuuk'), (b'Pacific/Easter', b'Pacific/Easter'), (b'Pacific/Efate', b'Pacific/Efate'), (b'Pacific/Enderbury', b'Pacific/Enderbury'), (b'Pacific/Fakaofo', b'Pacific/Fakaofo'), (b'Pacific/Fiji', b'Pacific/Fiji'), (b'Pacific/Funafuti', b'Pacific/Funafuti'), (b'Pacific/Galapagos', b'Pacific/Galapagos'), (b'Pacific/Gambier', b'Pacific/Gambier'), (b'Pacific/Guadalcanal', b'Pacific/Guadalcanal'), (b'Pacific/Guam', b'Pacific/Guam'), (b'Pacific/Honolulu', b'Pacific/Honolulu'), (b'Pacific/Johnston', b'Pacific/Johnston'), (b'Pacific/Kiritimati', b'Pacific/Kiritimati'), (b'Pacific/Kosrae', b'Pacific/Kosrae'), (b'Pacific/Kwajalein', b'Pacific/Kwajalein'), (b'Pacific/Majuro', b'Pacific/Majuro'), (b'Pacific/Marquesas', b'Pacific/Marquesas'), (b'Pacific/Midway', b'Pacific/Midway'), (b'Pacific/Nauru', b'Pacific/Nauru'), (b'Pacific/Niue', b'Pacific/Niue'), (b'Pacific/Norfolk', b'Pacific/Norfolk'), (b'Pacific/Noumea', b'Pacific/Noumea'), (b'Pacific/Pago_Pago', b'Pacific/Pago_Pago'), (b'Pacific/Palau', b'Pacific/Palau'), (b'Pacific/Pitcairn', b'Pacific/Pitcairn'), (b'Pacific/Pohnpei', b'Pacific/Pohnpei'), (b'Pacific/Ponape', b'Pacific/Ponape'), (b'Pacific/Port_Moresby', b'Pacific/Port_Moresby'), (b'Pacific/Rarotonga', b'Pacific/Rarotonga'), (b'Pacific/Saipan', b'Pacific/Saipan'), (b'Pacific/Samoa', b'Pacific/Samoa'), (b'Pacific/Tahiti', b'Pacific/Tahiti'), (b'Pacific/Tarawa', b'Pacific/Tarawa'), (b'Pacific/Tongatapu', b'Pacific/Tongatapu'), (b'Pacific/Truk', b'Pacific/Truk'), (b'Pacific/Wake', b'Pacific/Wake'), (b'Pacific/Wallis', b'Pacific/Wallis'), (b'Pacific/Yap', b'Pacific/Yap'), (b'Poland', b'Poland'), (b'Portugal', b'Portugal'), (b'ROC', b'ROC'), (b'ROK', b'ROK'), (b'Singapore', b'Singapore'), (b'Turkey', b'Turkey'), (b'UCT', b'UCT'), (b'US/Alaska', b'US/Alaska'), (b'US/Aleutian', b'US/Aleutian'), (b'US/Arizona', b'US/Arizona'), (b'US/Central', b'US/Central'), (b'US/East-Indiana', b'US/East-Indiana'), (b'US/Eastern', b'US/Eastern'), (b'US/Hawaii', b'US/Hawaii'), (b'US/Indiana-Starke', b'US/Indiana-Starke'), (b'US/Michigan', b'US/Michigan'), (b'US/Mountain', b'US/Mountain'), (b'US/Pacific', b'US/Pacific'), (b'US/Pacific-New', b'US/Pacific-New'), (b'US/Samoa', b'US/Samoa'), (b'UTC', b'UTC'), (b'Universal', b'Universal'), (b'W-SU', b'W-SU'), (b'WET', b'WET'), (b'Zulu', b'Zulu')])), ('language', models.CharField(default=b'en-us', max_length=10, verbose_name='language', choices=[(b'af', 'Afrikaans'), (b'ar', '\u0627\u0644\u0639\u0631\u0628\u064a\u0651\u0629'), (b'ast', 'asturianu'), (b'az', 'Az\u0259rbaycanca'), (b'bg', '\u0431\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438'), (b'be', '\u0431\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f'), (b'bn', '\u09ac\u09be\u0982\u09b2\u09be'), (b'br', 'brezhoneg'), (b'bs', 'bosanski'), (b'ca', 'catal\xe0'), (b'cs', '\u010desky'), (b'cy', 'Cymraeg'), (b'da', 'dansk'), (b'de', 'Deutsch'), (b'el', '\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac'), (b'en', 'English'), (b'en-au', 'Australian English'), (b'en-gb', 'British English'), (b'eo', 'Esperanto'), (b'es', 'espa\xf1ol'), (b'es-ar', 'espa\xf1ol de Argentina'), (b'es-mx', 'espa\xf1ol de Mexico'), (b'es-ni', 'espa\xf1ol de Nicaragua'), (b'es-ve', 'espa\xf1ol de Venezuela'), (b'et', 'eesti'), (b'eu', 'Basque'), (b'fa', '\u0641\u0627\u0631\u0633\u06cc'), (b'fi', 'suomi'), (b'fr', 'fran\xe7ais'), (b'fy', 'frysk'), (b'ga', 'Gaeilge'), (b'gl', 'galego'), (b'he', '\u05e2\u05d1\u05e8\u05d9\u05ea'), (b'hi', 'Hindi'), (b'hr', 'Hrvatski'), (b'hu', 'Magyar'), (b'ia', 'Interlingua'), (b'id', 'Bahasa Indonesia'), (b'io', 'ido'), (b'is', '\xcdslenska'), (b'it', 'italiano'), (b'ja', '\u65e5\u672c\u8a9e'), (b'ka', '\u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8'), (b'kk', '\u049a\u0430\u0437\u0430\u049b'), (b'km', 'Khmer'), (b'kn', 'Kannada'), (b'ko', '\ud55c\uad6d\uc5b4'), (b'lb', 'L\xebtzebuergesch'), (b'lt', 'Lietuvi\u0161kai'), (b'lv', 'latvie\u0161u'), (b'mk', '\u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438'), (b'ml', 'Malayalam'), (b'mn', 'Mongolian'), (b'mr', '\u092e\u0930\u093e\u0920\u0940'), (b'my', '\u1019\u103c\u1014\u103a\u1019\u102c\u1018\u102c\u101e\u102c'), (b'nb', 'norsk (bokm\xe5l)'), (b'ne', '\u0928\u0947\u092a\u093e\u0932\u0940'), (b'nl', 'Nederlands'), (b'nn', 'norsk (nynorsk)'), (b'os', '\u0418\u0440\u043e\u043d'), (b'pa', 'Punjabi'), (b'pl', 'polski'), (b'pt', 'Portugu\xeas'), (b'pt-br', 'Portugu\xeas Brasileiro'), (b'ro', 'Rom\xe2n\u0103'), (b'ru', '\u0420\u0443\u0441\u0441\u043a\u0438\u0439'), (b'sk', 'slovensk\xfd'), (b'sl', 'Sloven\u0161\u010dina'), (b'sq', 'shqip'), (b'sr', '\u0441\u0440\u043f\u0441\u043a\u0438'), (b'sr-latn', 'srpski (latinica)'), (b'sv', 'svenska'), (b'sw', 'Kiswahili'), (b'ta', '\u0ba4\u0bae\u0bbf\u0bb4\u0bcd'), (b'te', '\u0c24\u0c46\u0c32\u0c41\u0c17\u0c41'), (b'th', '\u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22'), (b'tr', 'T\xfcrk\xe7e'), (b'tt', '\u0422\u0430\u0442\u0430\u0440\u0447\u0430'), (b'udm', '\u0423\u0434\u043c\u0443\u0440\u0442'), (b'uk', '\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430'), (b'ur', '\u0627\u0631\u062f\u0648'), (b'vi', 'Ti\xea\u0301ng Vi\xea\u0323t'), (b'zh-cn', '\u7b80\u4f53\u4e2d\u6587'), (b'zh-hans', '\u7b80\u4f53\u4e2d\u6587'), (b'zh-hant', '\u7e41\u9ad4\u4e2d\u6587'), (b'zh-tw', '\u7e41\u9ad4\u4e2d\u6587')])), - ('user', models.OneToOneField(related_name='account', verbose_name='user', to=settings.AUTH_USER_MODEL)), + ('user', models.OneToOneField(related_name='account', verbose_name='user', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], ), migrations.CreateModel( @@ -42,7 +42,7 @@ class Migration(migrations.Migration): ('email', models.EmailField(unique=True, max_length=254)), ('verified', models.BooleanField(default=False)), ('primary', models.BooleanField(default=False)), - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], options={ 'verbose_name': 'email address', @@ -56,7 +56,7 @@ class Migration(migrations.Migration): ('created', models.DateTimeField(default=django.utils.timezone.now)), ('sent', models.DateTimeField(null=True)), ('key', models.CharField(unique=True, max_length=64)), - ('email_address', models.ForeignKey(to='account.EmailAddress')), + ('email_address', models.ForeignKey(to='account.EmailAddress', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'email confirmation', @@ -75,7 +75,7 @@ class Migration(migrations.Migration): ('sent', models.DateTimeField(null=True, blank=True)), ('created', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ('use_count', models.PositiveIntegerField(default=0, editable=False)), - ('inviter', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)), + ('inviter', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL)), ], ), migrations.CreateModel( @@ -83,8 +83,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('timestamp', models.DateTimeField(default=datetime.datetime.now)), - ('signup_code', models.ForeignKey(to='account.SignupCode')), - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('signup_code', models.ForeignKey(to='account.SignupCode', on_delete=models.CASCADE)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], ), ] diff --git a/account/models.py b/account/models.py index 9e7405020..97b53736b 100644 --- a/account/models.py +++ b/account/models.py @@ -27,7 +27,7 @@ class Account(models.Model): - user = models.OneToOneField(User, related_name="account", verbose_name=_("user")) + user = models.OneToOneField(User, related_name="account", verbose_name=_("user"), on_delete=models.CASCADE) timezone = TimeZoneField(_("timezone")) language = models.CharField(_("language"), max_length=10, @@ -127,7 +127,7 @@ class InvalidCode(Exception): code = models.CharField(max_length=64, unique=True) max_uses = models.PositiveIntegerField(default=0) expiry = models.DateTimeField(null=True, blank=True) - inviter = models.ForeignKey(User, null=True, blank=True) + inviter = models.ForeignKey(User, null=True, blank=True, on_delete=models.SET_NULL) email = models.EmailField(blank=True) notes = models.TextField(blank=True) sent = models.DateTimeField(null=True, blank=True) @@ -221,8 +221,8 @@ def send(self, **kwargs): class SignupCodeResult(models.Model): - signup_code = models.ForeignKey(SignupCode) - user = models.ForeignKey(User) + signup_code = models.ForeignKey(SignupCode, on_delete=models.CASCADE) + user = models.ForeignKey(User, on_delete=models.CASCADE) timestamp = models.DateTimeField(default=datetime.datetime.now) def save(self, **kwargs): @@ -232,7 +232,7 @@ def save(self, **kwargs): class EmailAddress(models.Model): - user = models.ForeignKey(User) + user = models.ForeignKey(User, on_delete=models.CASCADE) email = models.EmailField(unique=settings.ACCOUNT_EMAIL_UNIQUE) verified = models.BooleanField(default=False) primary = models.BooleanField(default=False) @@ -285,7 +285,7 @@ def change(self, new_email, confirm=True): class EmailConfirmation(models.Model): - email_address = models.ForeignKey(EmailAddress) + email_address = models.ForeignKey(EmailAddress, on_delete=models.CASCADE) created = models.DateTimeField(default=timezone.now) sent = models.DateTimeField(null=True) key = models.CharField(max_length=64, unique=True) diff --git a/general/migrations/0001_initial.py b/general/migrations/0001_initial.py index 0caeb5d3c..6e742660c 100644 --- a/general/migrations/0001_initial.py +++ b/general/migrations/0001_initial.py @@ -54,7 +54,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Company', fields=[ - ('human', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Human')), + ('human', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Human', on_delete=models.CASCADE)), ('legal_name', models.CharField(max_length=200, null=True, verbose_name='Nom Fiscal', blank=True)), ('vat_number', models.CharField(max_length=20, null=True, verbose_name='CIF', blank=True)), ], @@ -77,7 +77,7 @@ class Migration(migrations.Migration): ('tree_id', models.PositiveIntegerField(editable=False, db_index=True)), ('level', models.PositiveIntegerField(editable=False, db_index=True)), ('clas', models.CharField(help_text="Model de django o classe python associada a l'Ofici'", max_length=50, verbose_name='Clase', blank=True)), - ('parent', mptt.fields.TreeForeignKey(related_name=b'subarts', blank=True, to='general.Job', null=True)), + ('parent', mptt.fields.TreeForeignKey(related_name=b'subarts', blank=True, to='general.Job', null=True, on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Ofici', @@ -101,7 +101,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Asset', fields=[ - ('material', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Material')), + ('material', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Material', on_delete=models.CASCADE)), ('reciprocity', models.TextField(verbose_name='Reciprocitat', blank=True)), ], options={ @@ -126,7 +126,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Image', fields=[ - ('nonmaterial', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Nonmaterial')), + ('nonmaterial', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Nonmaterial', on_delete=models.CASCADE)), ('image', models.ImageField(upload_to=b'files/images', width_field=b'width', height_field=b'height', blank=True, null=True, verbose_name='Imatge (jpg/png)')), ('url', models.URLField(null=True, verbose_name='Url de la imatge', blank=True)), ('height', models.IntegerField(null=True, verbose_name='Al\xe7ada', blank=True)), @@ -141,7 +141,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Person', fields=[ - ('human', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Human')), + ('human', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Human', on_delete=models.CASCADE)), ('surnames', models.CharField(help_text='Els cognoms de la Persona', max_length=200, verbose_name='Cognoms', blank=True)), ('id_card', models.CharField(max_length=9, verbose_name='DNI/NIE', blank=True)), ('email2', models.EmailField(max_length=75, verbose_name='Email alternatiu', blank=True)), @@ -156,7 +156,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Project', fields=[ - ('human', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Human')), + ('human', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Human', on_delete=models.CASCADE)), ('socialweb', models.CharField(max_length=100, verbose_name='Web Social', blank=True)), ('email2', models.EmailField(max_length=75, verbose_name='Email alternatiu', blank=True)), ('ecommerce', models.BooleanField(default=False, verbose_name='Comer\xe7 electr\xf2nic?')), @@ -164,7 +164,7 @@ class Migration(migrations.Migration): ('rght', models.PositiveIntegerField(editable=False, db_index=True)), ('tree_id', models.PositiveIntegerField(editable=False, db_index=True)), ('level', models.PositiveIntegerField(editable=False, db_index=True)), - ('parent', mptt.fields.TreeForeignKey(related_name=b'subprojects', verbose_name='Projecte Marc', blank=True, to='general.Project', null=True)), + ('parent', mptt.fields.TreeForeignKey(related_name=b'subprojects', verbose_name='Projecte Marc', blank=True, to='general.Project', null=True, on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Projecte', @@ -188,7 +188,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='AccountCrypto', fields=[ - ('record', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Record')), + ('record', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Record', on_delete=models.CASCADE)), ('number', models.CharField(max_length=34, verbose_name='Adre\xe7a de la bitlletera', blank=True)), ], options={ @@ -200,7 +200,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='AccountCes', fields=[ - ('record', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Record')), + ('record', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Record', on_delete=models.CASCADE)), ('code', models.CharField(max_length=10, null=True, verbose_name='Codi ecoxarxa', blank=True)), ('number', models.CharField(max_length=4, null=True, verbose_name='N\xfamero compte', blank=True)), ], @@ -213,7 +213,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='AccountBank', fields=[ - ('record', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Record')), + ('record', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Record', on_delete=models.CASCADE)), ('code', models.CharField(max_length=11, null=True, verbose_name='Codi SWIFT/BIC', blank=True)), ('number', models.CharField(max_length=34, null=True, verbose_name='N\xfamero de Compte IBAN', blank=True)), ('bankcard', models.BooleanField(default=False, verbose_name='Amb Tarjeta?')), @@ -234,7 +234,7 @@ class Migration(migrations.Migration): ('rght', models.PositiveIntegerField(editable=False, db_index=True)), ('tree_id', models.PositiveIntegerField(editable=False, db_index=True)), ('level', models.PositiveIntegerField(editable=False, db_index=True)), - ('parent', mptt.fields.TreeForeignKey(related_name=b'subregions', blank=True, to='general.Region', null=True)), + ('parent', mptt.fields.TreeForeignKey(related_name=b'subregions', blank=True, to='general.Region', null=True, on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Regi\xf3', @@ -247,8 +247,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('main_address', models.BooleanField(default=False, verbose_name='Adre\xe7a principal?')), - ('address', models.ForeignKey(related_name=b'rel_human', verbose_name='Adre\xe7a', to='general.Address', help_text="Un cop escollida l'adre\xe7a, desa el perfil per veure el seu nom aqu\xed.")), - ('human', models.ForeignKey(to='general.Human')), + ('address', models.ForeignKey(related_name=b'rel_human', verbose_name='Adre\xe7a', to='general.Address', help_text="Un cop escollida l'adre\xe7a, desa el perfil per veure el seu nom aqu\xed.", on_delete=models.CASCADE)), + ('human', models.ForeignKey(to='general.Human', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'H_adr', @@ -260,8 +260,8 @@ class Migration(migrations.Migration): name='rel_Human_Companies', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('company', models.ForeignKey(verbose_name='Empresa vinculada', to='general.Company')), - ('human', models.ForeignKey(related_name=b'human_companies', to='general.Human')), + ('company', models.ForeignKey(verbose_name='Empresa vinculada', to='general.Company', on_delete=models.SET_NULL)), + ('human', models.ForeignKey(related_name=b'human_companies', to='general.Human', on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'H_emp', @@ -273,8 +273,8 @@ class Migration(migrations.Migration): name='rel_Human_Jobs', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('human', models.ForeignKey(to='general.Human')), - ('job', mptt.fields.TreeForeignKey(verbose_name='Ofici', to='general.Job')), + ('human', models.ForeignKey(to='general.Human', on_delete=models.CASCADE)), + ('job', mptt.fields.TreeForeignKey(verbose_name='Ofici', to='general.Job', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'H_ofi', @@ -286,8 +286,8 @@ class Migration(migrations.Migration): name='rel_Human_Materials', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('human', models.ForeignKey(to='general.Human')), - ('material', models.ForeignKey(verbose_name='obra Material', to='general.Material')), + ('human', models.ForeignKey(to='general.Human', on_delete=models.CASCADE)), + ('material', models.ForeignKey(verbose_name='obra Material', to='general.Material', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'H_mat', @@ -299,8 +299,8 @@ class Migration(migrations.Migration): name='rel_Human_Nonmaterials', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('human', models.ForeignKey(to='general.Human')), - ('nonmaterial', models.ForeignKey(verbose_name='obra Inmaterial', to='general.Nonmaterial')), + ('human', models.ForeignKey(to='general.Human', on_delete=models.CASCADE)), + ('nonmaterial', models.ForeignKey(verbose_name='obra Inmaterial', to='general.Nonmaterial', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'H_inm', @@ -312,8 +312,8 @@ class Migration(migrations.Migration): name='rel_Human_Persons', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('human', models.ForeignKey(related_name=b'human_persons', to='general.Human')), - ('person', models.ForeignKey(related_name=b'rel_humans', verbose_name='Persona vinculada', to='general.Person')), + ('human', models.ForeignKey(related_name=b'human_persons', to='general.Human', on_delete=models.CASCADE)), + ('person', models.ForeignKey(related_name=b'rel_humans', verbose_name='Persona vinculada', to='general.Person', on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'H_per', @@ -325,8 +325,8 @@ class Migration(migrations.Migration): name='rel_Human_Projects', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('human', models.ForeignKey(related_name=b'human_projects', to='general.Human')), - ('project', mptt.fields.TreeForeignKey(related_name=b'rel_humans', verbose_name='Projecte vinculat', to='general.Project', help_text='Un cop escollit el projecte, desa el perfil per veure el seu nom aqu\xed.')), + ('human', models.ForeignKey(related_name=b'human_projects', to='general.Human', on_delete=models.CASCADE)), + ('project', mptt.fields.TreeForeignKey(related_name=b'rel_humans', verbose_name='Projecte vinculat', to='general.Project', help_text='Un cop escollit el projecte, desa el perfil per veure el seu nom aqu\xed.', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'H_pro', @@ -338,7 +338,7 @@ class Migration(migrations.Migration): name='rel_Human_Records', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('human', models.ForeignKey(to='general.Human')), + ('human', models.ForeignKey(to='general.Human', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'H_rec', @@ -350,8 +350,8 @@ class Migration(migrations.Migration): name='rel_Human_Regions', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('human', models.ForeignKey(to='general.Human')), - ('region', mptt.fields.TreeForeignKey(verbose_name='Regi\xf3', to='general.Region')), + ('human', models.ForeignKey(to='general.Human', on_delete=models.CASCADE)), + ('region', mptt.fields.TreeForeignKey(verbose_name='Regi\xf3', to='general.Region', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'H_reg', @@ -363,8 +363,8 @@ class Migration(migrations.Migration): name='rel_Material_Addresses', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('address', models.ForeignKey(related_name=b'materials', verbose_name='Adre\xe7a vinculada', to='general.Address')), - ('material', models.ForeignKey(to='general.Material')), + ('address', models.ForeignKey(related_name=b'materials', verbose_name='Adre\xe7a vinculada', to='general.Address', on_delete=models.CASCADE)), + ('material', models.ForeignKey(to='general.Material', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'M_adr', @@ -376,8 +376,8 @@ class Migration(migrations.Migration): name='rel_Material_Jobs', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('job', models.ForeignKey(related_name=b'materials', verbose_name='Arts/Oficis vinculades', to='general.Job')), - ('material', models.ForeignKey(to='general.Material')), + ('job', models.ForeignKey(related_name=b'materials', verbose_name='Arts/Oficis vinculades', to='general.Job', on_delete=models.CASCADE)), + ('material', models.ForeignKey(to='general.Material', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'M_ofi', @@ -389,8 +389,8 @@ class Migration(migrations.Migration): name='rel_Material_Materials', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('material', models.ForeignKey(to='general.Material')), - ('material2', models.ForeignKey(related_name=b'submaterials', verbose_name='obres Materials vinculades', to='general.Material')), + ('material', models.ForeignKey(to='general.Material', on_delete=models.CASCADE)), + ('material2', models.ForeignKey(related_name=b'submaterials', verbose_name='obres Materials vinculades', to='general.Material', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'M_mat', @@ -402,8 +402,8 @@ class Migration(migrations.Migration): name='rel_Material_Nonmaterials', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('material', models.ForeignKey(to='general.Material')), - ('nonmaterial', models.ForeignKey(verbose_name='Inmaterial vinculat', to='general.Nonmaterial')), + ('material', models.ForeignKey(to='general.Material', on_delete=models.CASCADE)), + ('nonmaterial', models.ForeignKey(verbose_name='Inmaterial vinculat', to='general.Nonmaterial', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'M_inm', @@ -415,7 +415,7 @@ class Migration(migrations.Migration): name='rel_Material_Records', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('material', models.ForeignKey(to='general.Material')), + ('material', models.ForeignKey(to='general.Material', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'M_rec', @@ -427,8 +427,8 @@ class Migration(migrations.Migration): name='rel_Nonmaterial_Addresses', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('address', models.ForeignKey(verbose_name='Adre\xe7a vinculada', to='general.Address')), - ('nonmaterial', models.ForeignKey(to='general.Nonmaterial')), + ('address', models.ForeignKey(verbose_name='Adre\xe7a vinculada', to='general.Address', on_delete=models.CASCADE)), + ('nonmaterial', models.ForeignKey(to='general.Nonmaterial', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'N_adr', @@ -440,8 +440,8 @@ class Migration(migrations.Migration): name='rel_Nonmaterial_Jobs', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('job', models.ForeignKey(related_name=b'nonmaterials', verbose_name='Arts/Oficis vinculades', to='general.Job')), - ('nonmaterial', models.ForeignKey(to='general.Nonmaterial')), + ('job', models.ForeignKey(related_name=b'nonmaterials', verbose_name='Arts/Oficis vinculades', to='general.Job', on_delete=models.CASCADE)), + ('nonmaterial', models.ForeignKey(to='general.Nonmaterial', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'N_ofi', @@ -453,8 +453,8 @@ class Migration(migrations.Migration): name='rel_Nonmaterial_Nonmaterials', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('nonmaterial', models.ForeignKey(to='general.Nonmaterial')), - ('nonmaterial2', models.ForeignKey(related_name=b'subnonmaterials', verbose_name='obres Inmaterials vinculades', to='general.Nonmaterial')), + ('nonmaterial', models.ForeignKey(to='general.Nonmaterial', on_delete=models.CASCADE)), + ('nonmaterial2', models.ForeignKey(related_name=b'subnonmaterials', verbose_name='obres Inmaterials vinculades', to='general.Nonmaterial', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'N_mat', @@ -466,7 +466,7 @@ class Migration(migrations.Migration): name='rel_Nonmaterial_Records', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('nonmaterial', models.ForeignKey(to='general.Nonmaterial')), + ('nonmaterial', models.ForeignKey(to='general.Nonmaterial', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'N_rec', @@ -487,7 +487,7 @@ class Migration(migrations.Migration): ('tree_id', models.PositiveIntegerField(editable=False, db_index=True)), ('level', models.PositiveIntegerField(editable=False, db_index=True)), ('clas', models.CharField(help_text='Model de django o classe python associada a la Relaci\xf3', max_length=50, verbose_name='Clase', blank=True)), - ('parent', mptt.fields.TreeForeignKey(related_name=b'subarts', blank=True, to='general.Relation', null=True)), + ('parent', mptt.fields.TreeForeignKey(related_name=b'subarts', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Relaci\xf3', @@ -515,7 +515,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Space_Type', fields=[ - ('typ', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Type')), + ('typ', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': "Tipus d'Espai", @@ -526,7 +526,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Address_Type', fields=[ - ('space_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Space_Type')), + ('space_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Space_Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': "Tipus d'Adre\xe7a", @@ -537,7 +537,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Region_Type', fields=[ - ('space_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Space_Type')), + ('space_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Space_Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'Tipus de Regi\xf3', @@ -548,7 +548,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Being_Type', fields=[ - ('typ', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Type')), + ('typ', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': "Tipus d'entitat", @@ -559,7 +559,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Project_Type', fields=[ - ('being_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Being_Type')), + ('being_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Being_Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'Tipus de Projecte', @@ -570,7 +570,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Company_Type', fields=[ - ('being_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Being_Type')), + ('being_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Being_Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': "Tipus d'Empresa", @@ -581,7 +581,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Artwork_Type', fields=[ - ('typ', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Type')), + ('typ', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': "Tipus d'Obra", @@ -592,7 +592,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Record_Type', fields=[ - ('artwork_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Artwork_Type')), + ('artwork_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Artwork_Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'Tipus de Registre', @@ -603,7 +603,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Nonmaterial_Type', fields=[ - ('artwork_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Artwork_Type')), + ('artwork_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Artwork_Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': "Tipus d'obra Inmaterial", @@ -614,7 +614,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Material_Type', fields=[ - ('artwork_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Artwork_Type')), + ('artwork_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Artwork_Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': "Tipus d'obra Material", @@ -629,8 +629,8 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=200, null=True, verbose_name='Nom', blank=True)), ('description', models.TextField(null=True, verbose_name='Descripci\xf3', blank=True)), ('code', models.CharField(max_length=4, verbose_name='Codi o S\xedmbol')), - ('human', models.ForeignKey(verbose_name='Entitat relacionada', blank=True, to='general.Human', null=True)), - ('region', mptt.fields.TreeForeignKey(verbose_name="Regi\xf3 d'us associada", blank=True, to='general.Region', null=True)), + ('human', models.ForeignKey(verbose_name='Entitat relacionada', blank=True, to='general.Human', null=True, on_delete=models.SET_NULL)), + ('region', mptt.fields.TreeForeignKey(verbose_name="Regi\xf3 d'us associada", blank=True, to='general.Region', null=True, on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Unitat', @@ -641,7 +641,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Unit_Type', fields=[ - ('artwork_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Artwork_Type')), + ('artwork_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Artwork_Type', on_delete=models.CASCADE)), ], options={ 'verbose_name': "Tipus d'Unitat", @@ -652,10 +652,10 @@ class Migration(migrations.Migration): migrations.CreateModel( name='UnitRatio', fields=[ - ('record', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Record')), + ('record', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Record', on_delete=models.CASCADE)), ('rate', models.DecimalField(verbose_name='Ratio multiplicador', max_digits=6, decimal_places=3)), - ('in_unit', models.ForeignKey(related_name=b'ratio_in', verbose_name='Unitat entrant', to='general.Unit')), - ('out_unit', models.ForeignKey(related_name=b'ratio_out', verbose_name='Unitat sortint', to='general.Unit')), + ('in_unit', models.ForeignKey(related_name=b'ratio_in', verbose_name='Unitat entrant', to='general.Unit', on_delete=models.CASCADE)), + ('out_unit', models.ForeignKey(related_name=b'ratio_out', verbose_name='Unitat sortint', to='general.Unit', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'Equivalencia entre Unitats', @@ -666,157 +666,157 @@ class Migration(migrations.Migration): migrations.AddField( model_name='unit', name='unit_type', - field=mptt.fields.TreeForeignKey(verbose_name="Tipus d'Unitat", blank=True, to='general.Unit_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name="Tipus d'Unitat", blank=True, to='general.Unit_Type', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='type', name='parent', - field=mptt.fields.TreeForeignKey(related_name=b'children', blank=True, to='general.Type', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'children', blank=True, to='general.Type', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_nonmaterial_records', name='record', - field=models.ForeignKey(verbose_name='Registre vinculat', to='general.Record'), + field=models.ForeignKey(verbose_name='Registre vinculat', to='general.Record', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='rel_nonmaterial_records', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'no_reg+', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'no_reg+', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_nonmaterial_nonmaterials', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'ma_mat+', verbose_name='Relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'ma_mat+', verbose_name='Relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_nonmaterial_jobs', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'no_job+', verbose_name='Relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'no_job+', verbose_name='Relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_nonmaterial_addresses', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'no_adr+', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'no_adr+', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_material_records', name='record', - field=models.ForeignKey(verbose_name='Registre vinculat', to='general.Record'), + field=models.ForeignKey(verbose_name='Registre vinculat', to='general.Record', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='rel_material_records', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'ma_reg+', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'ma_reg+', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_material_nonmaterials', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'ma_non+', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'ma_non+', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_material_materials', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'ma_mat+', verbose_name='Relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'ma_mat+', verbose_name='Relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_material_jobs', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'ma_job+', verbose_name='Relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'ma_job+', verbose_name='Relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_material_addresses', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'ma_adr+', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'ma_adr+', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_human_regions', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'hu_reg+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'hu_reg+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_human_records', name='record', - field=models.ForeignKey(verbose_name='Registre', to='general.Record'), + field=models.ForeignKey(verbose_name='Registre', to='general.Record', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='rel_human_records', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'hu_rec+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'hu_rec+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_human_projects', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'hu_hum+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'hu_hum+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_human_persons', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'hu_hum+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'hu_hum+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_human_nonmaterials', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'hu_non+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'hu_non+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_human_materials', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'hu_mat+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'hu_mat+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_human_jobs', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'hu_job+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'hu_job+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_human_companies', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'hu_hum+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'hu_hum+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='rel_human_addresses', name='relation', - field=mptt.fields.TreeForeignKey(related_name=b'hu_adr+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'hu_adr+', verbose_name='relaci\xf3', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='region', name='region_type', - field=mptt.fields.TreeForeignKey(verbose_name='Tipus de regi\xf3', blank=True, to='general.Region_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Tipus de regi\xf3', blank=True, to='general.Region_Type', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='record', name='record_type', - field=mptt.fields.TreeForeignKey(verbose_name='Tipus de Registre', blank=True, to='general.Record_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Tipus de Registre', blank=True, to='general.Record_Type', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='project', name='project_type', - field=mptt.fields.TreeForeignKey(verbose_name='Tipus de projecte', blank=True, to='general.Project_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Tipus de projecte', blank=True, to='general.Project_Type', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( @@ -834,7 +834,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='nonmaterial', name='nonmaterial_type', - field=mptt.fields.TreeForeignKey(verbose_name="Tipus d'obra inmaterial", blank=True, to='general.Nonmaterial_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name="Tipus d'obra inmaterial", blank=True, to='general.Nonmaterial_Type', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( @@ -864,7 +864,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='material', name='material_type', - field=mptt.fields.TreeForeignKey(verbose_name="Tipus d'obra f\xedsica", blank=True, to='general.Material_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name="Tipus d'obra f\xedsica", blank=True, to='general.Material_Type', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( @@ -942,19 +942,19 @@ class Migration(migrations.Migration): migrations.AddField( model_name='company', name='company_type', - field=mptt.fields.TreeForeignKey(verbose_name="Tipus d'empresa", blank=True, to='general.Company_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name="Tipus d'empresa", blank=True, to='general.Company_Type', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='asset', name='human', - field=models.ForeignKey(verbose_name='Entitat', to='general.Human'), + field=models.ForeignKey(verbose_name='Entitat', to='general.Human', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='address', name='address_type', - field=mptt.fields.TreeForeignKey(verbose_name="Tipus d'adre\xe7a", blank=True, to='general.Address_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name="Tipus d'adre\xe7a", blank=True, to='general.Address_Type', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( @@ -966,61 +966,61 @@ class Migration(migrations.Migration): migrations.AddField( model_name='address', name='region', - field=mptt.fields.TreeForeignKey(related_name=b'rel_addresses', verbose_name='Comarca', blank=True, to='general.Region', null=True), + field=mptt.fields.TreeForeignKey(related_name=b'rel_addresses', verbose_name='Comarca', blank=True, to='general.Region', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='address', name='size_unit', - field=models.ForeignKey(verbose_name='Unitat de mesura', blank=True, to='general.Unit', null=True), + field=models.ForeignKey(verbose_name='Unitat de mesura', blank=True, to='general.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='accountcrypto', name='human', - field=models.ForeignKey(related_name=b'accountsCrypto', verbose_name='Entitat humana titular', to='general.Human'), + field=models.ForeignKey(related_name=b'accountsCrypto', verbose_name='Entitat humana titular', to='general.Human', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='accountcrypto', name='unit', - field=models.ForeignKey(verbose_name='Unitat (moneda)', to='general.Unit'), + field=models.ForeignKey(verbose_name='Unitat (moneda)', to='general.Unit', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='accountces', name='entity', - field=models.ForeignKey(verbose_name='Xarxa del compte', to='general.Project'), + field=models.ForeignKey(verbose_name='Xarxa del compte', to='general.Project', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='accountces', name='human', - field=models.ForeignKey(related_name=b'accountsCes', verbose_name='Entitat humana persuaria', to='general.Human'), + field=models.ForeignKey(related_name=b'accountsCes', verbose_name='Entitat humana persuaria', to='general.Human', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='accountces', name='unit', - field=models.ForeignKey(verbose_name='Unitat (moneda)', to='general.Unit'), + field=models.ForeignKey(verbose_name='Unitat (moneda)', to='general.Unit', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='accountbank', name='company', - field=models.ForeignKey(verbose_name='Entitat Bancaria', blank=True, to='general.Company', null=True), + field=models.ForeignKey(verbose_name='Entitat Bancaria', blank=True, to='general.Company', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='accountbank', name='human', - field=models.ForeignKey(related_name=b'accountsBank', verbose_name='Entitat humana titular', to='general.Human'), + field=models.ForeignKey(related_name=b'accountsBank', verbose_name='Entitat humana titular', to='general.Human', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='accountbank', name='unit', - field=models.ForeignKey(verbose_name='Unitat (moneda)', blank=True, to='general.Unit', null=True), + field=models.ForeignKey(verbose_name='Unitat (moneda)', blank=True, to='general.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), ] diff --git a/general/migrations/0002_auto_20161130_1145.py b/general/migrations/0002_auto_20161130_1145.py index 74ee15c24..5e981a7f3 100644 --- a/general/migrations/0002_auto_20161130_1145.py +++ b/general/migrations/0002_auto_20161130_1145.py @@ -217,12 +217,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='accountbank', name='company', - field=models.ForeignKey(verbose_name='Bank entity', blank=True, to='general.Company', null=True), + field=models.ForeignKey(verbose_name='Bank entity', blank=True, to='general.Company', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='accountbank', name='human', - field=models.ForeignKey(related_name='accountsBank', verbose_name='Owner human entity', to='general.Human'), + field=models.ForeignKey(related_name='accountsBank', verbose_name='Owner human entity', to='general.Human', on_delete=models.CASCADE), ), migrations.AlterField( model_name='accountbank', @@ -232,7 +232,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='accountbank', name='unit', - field=models.ForeignKey(verbose_name='Unit (currency)', blank=True, to='general.Unit', null=True), + field=models.ForeignKey(verbose_name='Unit (currency)', blank=True, to='general.Unit', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='accountces', @@ -242,12 +242,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='accountces', name='entity', - field=models.ForeignKey(verbose_name='Network of the account', to='general.Project'), + field=models.ForeignKey(verbose_name='Network of the account', to='general.Project', on_delete=models.CASCADE), ), migrations.AlterField( model_name='accountces', name='human', - field=models.ForeignKey(related_name='accountsCes', verbose_name='Owner human entity', to='general.Human'), + field=models.ForeignKey(related_name='accountsCes', verbose_name='Owner human entity', to='general.Human', on_delete=models.CASCADE), ), migrations.AlterField( model_name='accountces', @@ -257,12 +257,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='accountces', name='unit', - field=models.ForeignKey(verbose_name='Unit (currency)', to='general.Unit'), + field=models.ForeignKey(verbose_name='Unit (currency)', to='general.Unit', on_delete=models.CASCADE), ), migrations.AlterField( model_name='accountcrypto', name='human', - field=models.ForeignKey(related_name='accountsCrypto', verbose_name='Owner human entity', to='general.Human'), + field=models.ForeignKey(related_name='accountsCrypto', verbose_name='Owner human entity', to='general.Human', on_delete=models.CASCADE), ), migrations.AlterField( model_name='accountcrypto', @@ -272,12 +272,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='accountcrypto', name='unit', - field=models.ForeignKey(verbose_name='Unit (currency)', to='general.Unit'), + field=models.ForeignKey(verbose_name='Unit (currency)', to='general.Unit', on_delete=models.CASCADE), ), migrations.AlterField( model_name='address', name='address_type', - field=mptt.fields.TreeForeignKey(verbose_name='Type of address', blank=True, to='general.Address_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Type of address', blank=True, to='general.Address_Type', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='address', @@ -322,7 +322,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='address', name='region', - field=mptt.fields.TreeForeignKey(related_name='rel_addresses', verbose_name='Region', blank=True, to='general.Region', null=True), + field=mptt.fields.TreeForeignKey(related_name='rel_addresses', verbose_name='Region', blank=True, to='general.Region', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='address', @@ -332,7 +332,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='address', name='size_unit', - field=models.ForeignKey(verbose_name='Unit of measure', blank=True, to='general.Unit', null=True), + field=models.ForeignKey(verbose_name='Unit of measure', blank=True, to='general.Unit', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='address', @@ -342,7 +342,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='asset', name='human', - field=models.ForeignKey(verbose_name='Entity', to='general.Human'), + field=models.ForeignKey(verbose_name='Entity', to='general.Human', on_delete=models.CASCADE), ), migrations.AlterField( model_name='asset', @@ -352,7 +352,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='company', name='company_type', - field=mptt.fields.TreeForeignKey(verbose_name='Type of company', blank=True, to='general.Company_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Type of company', blank=True, to='general.Company_Type', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='company', @@ -512,7 +512,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='material', name='material_type', - field=mptt.fields.TreeForeignKey(verbose_name='Type of physical artwork', blank=True, to='general.Material_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Type of physical artwork', blank=True, to='general.Material_Type', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='material', @@ -557,7 +557,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='nonmaterial', name='nonmaterial_type', - field=mptt.fields.TreeForeignKey(verbose_name='Type of non-material artwork', blank=True, to='general.Nonmaterial_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Type of non-material artwork', blank=True, to='general.Nonmaterial_Type', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='nonmaterial', @@ -602,12 +602,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='project', name='parent', - field=mptt.fields.TreeForeignKey(related_name='subprojects', verbose_name='Parent project', blank=True, to='general.Project', null=True), + field=mptt.fields.TreeForeignKey(related_name='subprojects', verbose_name='Parent project', blank=True, to='general.Project', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='project', name='project_type', - field=mptt.fields.TreeForeignKey(verbose_name='Type of project', blank=True, to='general.Project_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Type of project', blank=True, to='general.Project_Type', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='project', @@ -627,7 +627,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='record', name='record_type', - field=mptt.fields.TreeForeignKey(verbose_name='Type of Record', blank=True, to='general.Record_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Type of Record', blank=True, to='general.Record_Type', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='region', @@ -642,12 +642,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='region', name='region_type', - field=mptt.fields.TreeForeignKey(verbose_name='Type of region', blank=True, to='general.Region_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Type of region', blank=True, to='general.Region_Type', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_human_addresses', name='address', - field=models.ForeignKey(related_name='rel_human', verbose_name='Address', to='general.Address', help_text='Once choosed the address, save the profile to see the changes.'), + field=models.ForeignKey(related_name='rel_human', verbose_name='Address', to='general.Address', help_text='Once choosed the address, save the profile to see the changes.', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_human_addresses', @@ -657,142 +657,142 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='rel_human_addresses', name='relation', - field=mptt.fields.TreeForeignKey(related_name='hu_adr+', verbose_name='relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='hu_adr+', verbose_name='relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_human_companies', name='company', - field=models.ForeignKey(verbose_name='related Company', to='general.Company'), + field=models.ForeignKey(verbose_name='related Company', to='general.Company', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_human_companies', name='relation', - field=mptt.fields.TreeForeignKey(related_name='hu_hum+', verbose_name='relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='hu_hum+', verbose_name='relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_human_materials', name='material', - field=models.ForeignKey(verbose_name='Material artwork', to='general.Material'), + field=models.ForeignKey(verbose_name='Material artwork', to='general.Material', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_human_materials', name='relation', - field=mptt.fields.TreeForeignKey(related_name='hu_mat+', verbose_name='relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='hu_mat+', verbose_name='relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_human_nonmaterials', name='nonmaterial', - field=models.ForeignKey(verbose_name='Non-material artwork', to='general.Nonmaterial'), + field=models.ForeignKey(verbose_name='Non-material artwork', to='general.Nonmaterial', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_human_nonmaterials', name='relation', - field=mptt.fields.TreeForeignKey(related_name='hu_non+', verbose_name='relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='hu_non+', verbose_name='relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_human_persons', name='person', - field=models.ForeignKey(related_name='rel_humans', verbose_name='Related person', to='general.Person'), + field=models.ForeignKey(related_name='rel_humans', verbose_name='Related person', to='general.Person', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_human_persons', name='relation', - field=mptt.fields.TreeForeignKey(related_name='hu_hum+', verbose_name='relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='hu_hum+', verbose_name='relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_human_projects', name='project', - field=mptt.fields.TreeForeignKey(related_name='rel_humans', verbose_name='Related project', to='general.Project', help_text='Once choosed the project, save the profile to see the changes.'), + field=mptt.fields.TreeForeignKey(related_name='rel_humans', verbose_name='Related project', to='general.Project', help_text='Once choosed the project, save the profile to see the changes.', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_human_projects', name='relation', - field=mptt.fields.TreeForeignKey(related_name='hu_hum+', verbose_name='relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='hu_hum+', verbose_name='relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_human_records', name='record', - field=models.ForeignKey(verbose_name='Record', to='general.Record'), + field=models.ForeignKey(verbose_name='Record', to='general.Record', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_human_records', name='relation', - field=mptt.fields.TreeForeignKey(related_name='hu_rec+', verbose_name='relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='hu_rec+', verbose_name='relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_human_regions', name='region', - field=mptt.fields.TreeForeignKey(verbose_name='Region', to='general.Region'), + field=mptt.fields.TreeForeignKey(verbose_name='Region', to='general.Region', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_human_regions', name='relation', - field=mptt.fields.TreeForeignKey(related_name='hu_reg+', verbose_name='relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='hu_reg+', verbose_name='relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_material_addresses', name='address', - field=models.ForeignKey(related_name='materials', verbose_name='related Address', to='general.Address'), + field=models.ForeignKey(related_name='materials', verbose_name='related Address', to='general.Address', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_material_jobs', name='job', - field=models.ForeignKey(related_name='materials', verbose_name='related Arts/Jobs', to='general.Job'), + field=models.ForeignKey(related_name='materials', verbose_name='related Arts/Jobs', to='general.Job', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_material_jobs', name='relation', - field=mptt.fields.TreeForeignKey(related_name='ma_job+', verbose_name='Relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='ma_job+', verbose_name='Relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_material_materials', name='material2', - field=models.ForeignKey(related_name='submaterials', verbose_name='related Material artworks', to='general.Material'), + field=models.ForeignKey(related_name='submaterials', verbose_name='related Material artworks', to='general.Material', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_material_materials', name='relation', - field=mptt.fields.TreeForeignKey(related_name='ma_mat+', verbose_name='Relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='ma_mat+', verbose_name='Relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_material_nonmaterials', name='nonmaterial', - field=models.ForeignKey(verbose_name='related Non-material', to='general.Nonmaterial'), + field=models.ForeignKey(verbose_name='related Non-material', to='general.Nonmaterial', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_material_records', name='record', - field=models.ForeignKey(verbose_name='related Record', to='general.Record'), + field=models.ForeignKey(verbose_name='related Record', to='general.Record', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_nonmaterial_addresses', name='address', - field=models.ForeignKey(verbose_name='related Address', to='general.Address'), + field=models.ForeignKey(verbose_name='related Address', to='general.Address', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_nonmaterial_jobs', name='job', - field=models.ForeignKey(related_name='nonmaterials', verbose_name='related Arts/Jobs', to='general.Job'), + field=models.ForeignKey(related_name='nonmaterials', verbose_name='related Arts/Jobs', to='general.Job', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_nonmaterial_jobs', name='relation', - field=mptt.fields.TreeForeignKey(related_name='no_job+', verbose_name='Relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='no_job+', verbose_name='Relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_nonmaterial_nonmaterials', name='nonmaterial2', - field=models.ForeignKey(related_name='subnonmaterials', verbose_name='related Non-material Artworks', to='general.Nonmaterial'), + field=models.ForeignKey(related_name='subnonmaterials', verbose_name='related Non-material Artworks', to='general.Nonmaterial', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_nonmaterial_nonmaterials', name='relation', - field=mptt.fields.TreeForeignKey(related_name='ma_mat+', verbose_name='Relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='ma_mat+', verbose_name='Relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='rel_nonmaterial_records', name='record', - field=models.ForeignKey(verbose_name='related Record', to='general.Record'), + field=models.ForeignKey(verbose_name='related Record', to='general.Record', on_delete=models.CASCADE), ), migrations.AlterField( model_name='relation', @@ -847,7 +847,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='unit', name='human', - field=models.ForeignKey(verbose_name='related Entity', blank=True, to='general.Human', null=True), + field=models.ForeignKey(verbose_name='related Entity', blank=True, to='general.Human', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='unit', @@ -857,22 +857,22 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='unit', name='region', - field=mptt.fields.TreeForeignKey(verbose_name='related use Region', blank=True, to='general.Region', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='related use Region', blank=True, to='general.Region', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='unit', name='unit_type', - field=mptt.fields.TreeForeignKey(verbose_name='Type of Unit', blank=True, to='general.Unit_Type', null=True), + field=mptt.fields.TreeForeignKey(verbose_name='Type of Unit', blank=True, to='general.Unit_Type', null=True, on_delete=models.SET_NULL), ), migrations.AlterField( model_name='unitratio', name='in_unit', - field=models.ForeignKey(related_name='ratio_in', verbose_name='in Unit', to='general.Unit'), + field=models.ForeignKey(related_name='ratio_in', verbose_name='in Unit', to='general.Unit', on_delete=models.CASCADE), ), migrations.AlterField( model_name='unitratio', name='out_unit', - field=models.ForeignKey(related_name='ratio_out', verbose_name='out Unit', to='general.Unit'), + field=models.ForeignKey(related_name='ratio_out', verbose_name='out Unit', to='general.Unit', on_delete=models.CASCADE), ), migrations.AlterField( model_name='unitratio', diff --git a/general/migrations/0004_auto_20161201_1831.py b/general/migrations/0004_auto_20161201_1831.py index 27664386c..511278226 100644 --- a/general/migrations/0004_auto_20161201_1831.py +++ b/general/migrations/0004_auto_20161201_1831.py @@ -110,11 +110,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='rel_human_jobs', name='job', - field=mptt.fields.TreeForeignKey(verbose_name='Job', to='general.Job'), + field=mptt.fields.TreeForeignKey(verbose_name='Job', to='general.Job', on_delete=models.CASCADE), ), migrations.AlterField( model_name='rel_human_jobs', name='relation', - field=mptt.fields.TreeForeignKey(related_name='hu_job+', verbose_name='relation', blank=True, to='general.Relation', null=True), + field=mptt.fields.TreeForeignKey(related_name='hu_job+', verbose_name='relation', blank=True, to='general.Relation', null=True, on_delete=models.SET_NULL), ), ] diff --git a/general/models.py b/general/models.py index 2ddf8ed30..f87bde6a3 100644 --- a/general/models.py +++ b/general/models.py @@ -32,529 +32,529 @@ str_remove = 'erase' def erase_id_link(field, id): - out = ''+str_remove+'' - print(out) - return out + out = ''+str_remove+'' + print(out) + return out -# C O N C E P T S - (Concepts, Ideas...) +# C O N C E P T S - (Concepts, Ideas...) @python_2_unicode_compatible -class Concept(MPTTModel): # Abstract - name = models.CharField(unique=True, verbose_name=_(u"Name"), max_length=200, help_text=_(u"The name of the Concept"), default="") - description = models.TextField(blank=True, verbose_name=_(u"Description")) - parent = TreeForeignKey('self', null=True, blank=True, related_name='children') +class Concept(MPTTModel): # Abstract + name = models.CharField(unique=True, verbose_name=_(u"Name"), max_length=200, help_text=_(u"The name of the Concept"), default="") + description = models.TextField(blank=True, verbose_name=_(u"Description")) + parent = TreeForeignKey('self', null=True, blank=True, related_name='children', on_delete=models.CASCADE) - def __str__(self): - return self.name + def __str__(self): + return self.name - class Meta: - abstract = True - verbose_name = _(u"Concept") - verbose_name_plural = _(u"c- Concepts") + class Meta: + abstract = True + verbose_name = _(u"Concept") + verbose_name_plural = _(u"c- Concepts") @python_2_unicode_compatible -class Type(Concept): # Create own ID's (TREE) - #concept = models.OneToOneField('Concept', primary_key=True, parent_link=True) - clas = models.CharField(blank=True, verbose_name=_(u"Class"), max_length=200, - help_text=_(u"Django model or python class associated to the Type")) +class Type(Concept): # Create own ID's (TREE) + #concept = models.OneToOneField('Concept', primary_key=True, parent_link=True, on_delete=models.CASCADE) + clas = models.CharField(blank=True, verbose_name=_(u"Class"), max_length=200, + help_text=_(u"Django model or python class associated to the Type")) #types = TreeManyToManyField('self', through='rel_Type_Types', verbose_name=_(u"Related Types"), blank=True) - class Meta: - verbose_name = _(u"c- Type") - #verbose_name_plural = _(u"c- Types") + class Meta: + verbose_name = _(u"c- Type") + #verbose_name_plural = _(u"c- Types") - def __str__(self): - if self.clas is None or self.clas == '': - return self.name - else: - return self.name+' ('+self.clas+')' + def __str__(self): + if self.clas is None or self.clas == '': + return self.name + else: + return self.name+' ('+self.clas+')' """ class rel_Type_Types(models.Model): - typ = TreeForeignKey('Type') - typ2 = TreeForeignKey('Type', verbose_name=_(u"related Type")) - relation = TreeForeignKey('Relation', related_name='ty_typ+', blank=True, null=True, verbose_name=_(u"relation")) - class Meta: - verbose_name = _(u"T_type") - verbose_name_plural = _(u"Types related the Type") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.typ2.__str__() - else: - return self.relation.gerund+' > '+self.typ2.__str__() + typ = TreeForeignKey('Type', on_delete=models.CASCADE) + typ2 = TreeForeignKey('Type', verbose_name=_(u"related Type"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='ty_typ+', blank=True, null=True, verbose_name=_(u"relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"T_type") + verbose_name_plural = _(u"Types related the Type") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.typ2.__str__() + else: + return self.relation.gerund+' > '+self.typ2.__str__() """ -# B E I N G S - (Éssers, Entitats, Projectes...) +# B E I N G S - (Éssers, Entitats, Projectes...) """ @python_2_unicode_compatible -class Being(models.Model): # Abstract - name = models.CharField(verbose_name=_(u"Name"), max_length=200, help_text=_(u"The name of the Entity")) - #being_type = TreeForeignKey('Being_Type', blank=True, null=True, verbose_name=_(u"Tipus d'entitat")) - birth_date = models.DateField(blank=True, null=True, verbose_name=_(u"Born date"), help_text=_(u"The day of starting existence")) - death_date = models.DateField(blank=True, null=True, verbose_name=_(u"Die date"), help_text=_(u"The day of ceasing existence")) +class Being(models.Model): # Abstract + name = models.CharField(verbose_name=_(u"Name"), max_length=200, help_text=_(u"The name of the Entity")) + #being_type = TreeForeignKey('Being_Type', blank=True, null=True, verbose_name=_(u"Tipus d'entitat"), on_delete=models.SET_NULL) + birth_date = models.DateField(blank=True, null=True, verbose_name=_(u"Born date"), help_text=_(u"The day of starting existence")) + death_date = models.DateField(blank=True, null=True, verbose_name=_(u"Die date"), help_text=_(u"The day of ceasing existence")) - class Meta: - abstract = True + class Meta: + abstract = True - def __str__(self): - return self.name.encode("utf-8") + def __str__(self): + return self.name.encode("utf-8") """ class Being_Type(Type): - typ = models.OneToOneField('Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name= _(u"Type of entity") - verbose_name_plural = _(u"e--> Types of entities") + typ = models.OneToOneField('Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + class Meta: + verbose_name= _(u"Type of entity") + verbose_name_plural = _(u"e--> Types of entities") """ @python_2_unicode_compatible -class Human(Being): # Create own ID's - nickname = models.CharField(max_length=50, blank=True, verbose_name=_(u"Nickname"), help_text=_(u"The nickname most used of the human entity")) - email = models.EmailField(max_length=100, blank=True, verbose_name=_(u"Email"), help_text=_(u"The main email address of the human entity")) - telephone_cell = models.CharField(max_length=20, blank=True, verbose_name=_(u"Mobile phone"), help_text=_(u"The main telephone of the human entity")) - telephone_land = models.CharField(max_length=20, blank=True, verbose_name=_(u"Land phone")) - website = models.CharField(max_length=100, blank=True, verbose_name=_(u"Web"), help_text=_(u"The main web url of the human entity")) - description = models.TextField(blank=True, null=True, verbose_name=_(u"Entity description")) - - jobs = TreeManyToManyField('Job', through='rel_Human_Jobs', verbose_name=_(u"Activities, Jobs, Skills"), blank=True) - addresses = models.ManyToManyField('Address', through='rel_Human_Addresses', verbose_name=_(u"Addresses"), blank=True) - regions = models.ManyToManyField('Region', through='rel_Human_Regions', verbose_name=_(u"Regions"), blank=True) - records = models.ManyToManyField('Record', through='rel_Human_Records', verbose_name=_(u"Records"), blank=True) - materials = models.ManyToManyField('Material', through='rel_Human_Materials', verbose_name=_(u"Material artworks"), blank=True) - nonmaterials = models.ManyToManyField('Nonmaterial', through='rel_Human_Nonmaterials', verbose_name=_(u"Non-material artworks"), blank=True) - persons = models.ManyToManyField('Person', through='rel_Human_Persons', related_name='hum_persons', verbose_name=_(u"Persons"), blank=True) - projects = models.ManyToManyField('Project', through='rel_Human_Projects', related_name='hum_projects', verbose_name=_(u"Projects"), blank=True) - companies = models.ManyToManyField('Company', through='rel_Human_Companies', related_name='hum_companies', verbose_name=_(u"Companies"), blank=True) - - class Meta: - verbose_name = _(u"Human") - verbose_name_plural = _(u"e- Humans") - - def __str__(self): - if self.nickname is None or self.nickname == '': - return self.name - else: - return self.nickname+' ('+self.name+')' - - def _my_accounts(self): - return list(chain(self.accountsCes.all(), self.accountsCrypto.all(), self.accountsBank.all())) - #_my_accounts.list = [] - accounts = property(_my_accounts) - - def _selflink(self): - if self.id: - if hasattr(self, 'person'): - return mark_safe( a_strG + "person/" + str(self.person.id) + a_str2 + a_edit + "") # % str(self.id)) - elif hasattr(self, 'project'): - return mark_safe( a_strG + "project/" + str(self.project.id) + a_str2 + a_edit + "")# % str(self.id) ) - else: - return "Not present" - _selflink.allow_tags = True - _selflink.short_description = '' - self_link = property (_selflink) - def _ic_membership(self): - try: - #print self.ic_membership_set.all() - if hasattr(self, 'ic_person_membership_set'): - ic_ms = self.ic_person_membership_set.all() - out = ul_tag - for ms in ic_ms: - out += '
  • '+a_strW + "ic_person_membership/" + str(ms.id) + a_str3 + ''+ms.name +"
  • " - return out+'' - elif hasattr(self, 'ic_project_membership_set'): - ic_ms = self.ic_project_membership_set.all() - out = ul_tag - for ms in ic_ms: - out += '
  • '+a_strW + "ic_project_membership/" + str(ms.id) + a_str3 + ''+ms.name +"
  • " - if out == ul_tag: - return str_none - return out+'' - return str_none - except: - return str_none - _ic_membership.allow_tags = True - _ic_membership.short_description = _(u"IC Membership") - - def _fees_to_pay(self): - try: - if self.out_fees.all().count() > 0: - out = ul_tag - for fe in self.out_fees.all(): - if not fe.payed: - out += '
  • '+a_strW + "fee/" + str(fe.id) + a_str3 +''+ fe.name + "
  • " - if out == ul_tag: - return str_none - return out+'' - return str_none - except: - return str_none - _fees_to_pay.allow_tags = True - _fees_to_pay.short_description = _(u"Fees to pay") - - def __init__(self, *args, **kwargs): - super(Human, self).__init__(*args, **kwargs) - - if not 'rel_tit' in globals(): - rel_tit = Relation.objects.get(clas='holder') - - #print 'I N I T H U M A N : '+self.name - - - '''if hasattr(self, 'accountsCes') and self.accountsCes.count() > 0: - recrels = rel_Human_Records.objects.filter(human=self, record__in=self.accountsCes.all()) - if recrels.count() == 0: - for acc in self.accountsCes.all(): - newrec, created = rel_Human_Records.objects.get_or_create(human=self, record=acc, relation=rel_tit) - print('- new_REC acc_Ces: CREATED:' + str(created) + ' :: ' + str(newrec)) - - if hasattr(self, 'accountsBank') and self.accountsBank.count() > 0: - recrels = rel_Human_Records.objects.filter(human=self, record__in=self.accountsBank.all()) - if recrels.count() == 0: - for acc in self.accountsBank.all(): - newrec, created = rel_Human_Records.objects.get_or_create(human=self, record=acc, relation=rel_tit) - print('- new_REC acc_Bank: CREATED:' + str(created) + ' :: ' + str(newrec)) - - if hasattr(self, 'accountsCrypto') and self.accountsCrypto.count() > 0: - recrels = rel_Human_Records.objects.filter(human=self, record__in=self.accountsCrypto.all()) - if recrels.count() == 0: - for acc in self.accountsCrypto.all(): - newrec, created = rel_Human_Records.objects.get_or_create(human=self, record=acc, relation=rel_tit) - print '- new_REC acc_Crypto: CREATED:'+str(created)+' :: '+str(newrec) +class Human(Being): # Create own ID's + nickname = models.CharField(max_length=50, blank=True, verbose_name=_(u"Nickname"), help_text=_(u"The nickname most used of the human entity")) + email = models.EmailField(max_length=100, blank=True, verbose_name=_(u"Email"), help_text=_(u"The main email address of the human entity")) + telephone_cell = models.CharField(max_length=20, blank=True, verbose_name=_(u"Mobile phone"), help_text=_(u"The main telephone of the human entity")) + telephone_land = models.CharField(max_length=20, blank=True, verbose_name=_(u"Land phone")) + website = models.CharField(max_length=100, blank=True, verbose_name=_(u"Web"), help_text=_(u"The main web url of the human entity")) + description = models.TextField(blank=True, null=True, verbose_name=_(u"Entity description")) + + jobs = TreeManyToManyField('Job', through='rel_Human_Jobs', verbose_name=_(u"Activities, Jobs, Skills"), blank=True) + addresses = models.ManyToManyField('Address', through='rel_Human_Addresses', verbose_name=_(u"Addresses"), blank=True) + regions = models.ManyToManyField('Region', through='rel_Human_Regions', verbose_name=_(u"Regions"), blank=True) + records = models.ManyToManyField('Record', through='rel_Human_Records', verbose_name=_(u"Records"), blank=True) + materials = models.ManyToManyField('Material', through='rel_Human_Materials', verbose_name=_(u"Material artworks"), blank=True) + nonmaterials = models.ManyToManyField('Nonmaterial', through='rel_Human_Nonmaterials', verbose_name=_(u"Non-material artworks"), blank=True) + persons = models.ManyToManyField('Person', through='rel_Human_Persons', related_name='hum_persons', verbose_name=_(u"Persons"), blank=True) + projects = models.ManyToManyField('Project', through='rel_Human_Projects', related_name='hum_projects', verbose_name=_(u"Projects"), blank=True) + companies = models.ManyToManyField('Company', through='rel_Human_Companies', related_name='hum_companies', verbose_name=_(u"Companies"), blank=True) + + class Meta: + verbose_name = _(u"Human") + verbose_name_plural = _(u"e- Humans") + + def __str__(self): + if self.nickname is None or self.nickname == '': + return self.name + else: + return self.nickname+' ('+self.name+')' + + def _my_accounts(self): + return list(chain(self.accountsCes.all(), self.accountsCrypto.all(), self.accountsBank.all())) + #_my_accounts.list = [] + accounts = property(_my_accounts) + + def _selflink(self): + if self.id: + if hasattr(self, 'person'): + return mark_safe( a_strG + "person/" + str(self.person.id) + a_str2 + a_edit + "") # % str(self.id)) + elif hasattr(self, 'project'): + return mark_safe( a_strG + "project/" + str(self.project.id) + a_str2 + a_edit + "")# % str(self.id) ) + else: + return "Not present" + _selflink.allow_tags = True + _selflink.short_description = '' + self_link = property (_selflink) + def _ic_membership(self): + try: + #print self.ic_membership_set.all() + if hasattr(self, 'ic_person_membership_set'): + ic_ms = self.ic_person_membership_set.all() + out = ul_tag + for ms in ic_ms: + out += '
  • '+a_strW + "ic_person_membership/" + str(ms.id) + a_str3 + ''+ms.name +"
  • " + return out+'' + elif hasattr(self, 'ic_project_membership_set'): + ic_ms = self.ic_project_membership_set.all() + out = ul_tag + for ms in ic_ms: + out += '
  • '+a_strW + "ic_project_membership/" + str(ms.id) + a_str3 + ''+ms.name +"
  • " + if out == ul_tag: + return str_none + return out+'' + return str_none + except: + return str_none + _ic_membership.allow_tags = True + _ic_membership.short_description = _(u"IC Membership") + + def _fees_to_pay(self): + try: + if self.out_fees.all().count() > 0: + out = ul_tag + for fe in self.out_fees.all(): + if not fe.payed: + out += '
  • '+a_strW + "fee/" + str(fe.id) + a_str3 +''+ fe.name + "
  • " + if out == ul_tag: + return str_none + return out+'' + return str_none + except: + return str_none + _fees_to_pay.allow_tags = True + _fees_to_pay.short_description = _(u"Fees to pay") + + def __init__(self, *args, **kwargs): + super(Human, self).__init__(*args, **kwargs) + + if not 'rel_tit' in globals(): + rel_tit = Relation.objects.get(clas='holder') + + #print 'I N I T H U M A N : '+self.name + + + '''if hasattr(self, 'accountsCes') and self.accountsCes.count() > 0: + recrels = rel_Human_Records.objects.filter(human=self, record__in=self.accountsCes.all()) + if recrels.count() == 0: + for acc in self.accountsCes.all(): + newrec, created = rel_Human_Records.objects.get_or_create(human=self, record=acc, relation=rel_tit) + print('- new_REC acc_Ces: CREATED:' + str(created) + ' :: ' + str(newrec)) + + if hasattr(self, 'accountsBank') and self.accountsBank.count() > 0: + recrels = rel_Human_Records.objects.filter(human=self, record__in=self.accountsBank.all()) + if recrels.count() == 0: + for acc in self.accountsBank.all(): + newrec, created = rel_Human_Records.objects.get_or_create(human=self, record=acc, relation=rel_tit) + print('- new_REC acc_Bank: CREATED:' + str(created) + ' :: ' + str(newrec)) + + if hasattr(self, 'accountsCrypto') and self.accountsCrypto.count() > 0: + recrels = rel_Human_Records.objects.filter(human=self, record__in=self.accountsCrypto.all()) + if recrels.count() == 0: + for acc in self.accountsCrypto.all(): + newrec, created = rel_Human_Records.objects.get_or_create(human=self, record=acc, relation=rel_tit) + print '- new_REC acc_Crypto: CREATED:'+str(created)+' :: '+str(newrec) ''' @python_2_unicode_compatible class Person(Human): - human = models.OneToOneField('Human', primary_key=True, parent_link=True, on_delete=models.CASCADE) - surnames = models.CharField(max_length=200, blank=True, verbose_name=_(u"Surnames"), help_text=_(u"The surnames of the Person")) - id_card = models.CharField(max_length=9, blank=True, verbose_name=_(u"ID/DNI/NIE")) - email2 = models.EmailField(blank=True, verbose_name=_(u"Alternate email")) - nickname2 = models.CharField(max_length=50, blank=True, verbose_name=_(u"Nickname in FairNetwork")) - - class Meta: - verbose_name= _(u'Person') - verbose_name_plural= _(u'e- Persons') - - def __str__(self): - if self.nickname is None or self.nickname == '': - if self.surnames is None or self.surnames == '': - return self.name+' '+self.nickname2 - else: - return self.name+' '+self.surnames - else: - #return self.nickname - if self.surnames is None or self.surnames == '': - return self.name+' ('+self.nickname+')' - else: - return self.name+' '+self.surnames+' ('+self.nickname+')' + human = models.OneToOneField('Human', primary_key=True, parent_link=True, on_delete=models.CASCADE) + surnames = models.CharField(max_length=200, blank=True, verbose_name=_(u"Surnames"), help_text=_(u"The surnames of the Person")) + id_card = models.CharField(max_length=9, blank=True, verbose_name=_(u"ID/DNI/NIE")) + email2 = models.EmailField(blank=True, verbose_name=_(u"Alternate email")) + nickname2 = models.CharField(max_length=50, blank=True, verbose_name=_(u"Nickname in FairNetwork")) + + class Meta: + verbose_name= _(u'Person') + verbose_name_plural= _(u'e- Persons') + + def __str__(self): + if self.nickname is None or self.nickname == '': + if self.surnames is None or self.surnames == '': + return self.name+' '+self.nickname2 + else: + return self.name+' '+self.surnames + else: + #return self.nickname + if self.surnames is None or self.surnames == '': + return self.name+' ('+self.nickname+')' + else: + return self.name+' '+self.surnames+' ('+self.nickname+')' @python_2_unicode_compatible class Project(MPTTModel, Human): - human = models.OneToOneField('Human', primary_key=True, parent_link=True, on_delete=models.CASCADE) - project_type = TreeForeignKey('Project_Type', blank=True, null=True, verbose_name=_(u"Type of project")) - parent = TreeForeignKey('self', null=True, blank=True, related_name='subprojects', verbose_name=_(u"Parent project")) - socialweb = models.CharField(max_length=100, blank=True, verbose_name=_(u"Social website")) - email2 = models.EmailField(blank=True, verbose_name=_(u"Alternate email")) - - ecommerce = models.BooleanField(default=False, verbose_name=_(u"E-commerce?")) - #images = models.ManyToManyField('Image', blank=True, null=True, verbose_name=_(u"Imatges")) - - def _is_collective(self): - if self.persons.count() < 2 and self.projects.count() < 2: - return False - else: - return True - _is_collective.boolean = True - _is_collective.short_description = _(u"is collective?") - collective = property(_is_collective) - - #ref_persons = models.ManyToManyField('Person', blank=True, null=True, verbose_name=_(u"Persones de referència")) - - class Meta: - verbose_name= _(u'Project') - verbose_name_plural= _(u'e- Projects') - - def _get_ref_persons(self): - return self.human_persons.filter(relation__clas='reference') - - def _ref_persons(self): - prs = self._get_ref_persons() - if prs.count() > 0: - out = ul_tag - for pr in prs: - out += '
  • '+str(pr)+'
  • ' - return out+'' - return str_none - _ref_persons.allow_tags = True - _ref_persons.short_description = _(u"Reference person?") - - def __str__(self): - if self.nickname is None or self.nickname == '': - if self.project_type: - return self.name+' ('+self.project_type.name+')' - else: - return self.name - else: - return self.nickname+' ('+self.name+')' + human = models.OneToOneField('Human', primary_key=True, parent_link=True, on_delete=models.CASCADE) + project_type = TreeForeignKey('Project_Type', blank=True, null=True, verbose_name=_(u"Type of project"), on_delete=models.SET_NULL) + parent = TreeForeignKey('self', null=True, blank=True, related_name='subprojects', verbose_name=_(u"Parent project"), on_delete=models.SET_NULL) + socialweb = models.CharField(max_length=100, blank=True, verbose_name=_(u"Social website")) + email2 = models.EmailField(blank=True, verbose_name=_(u"Alternate email")) + + ecommerce = models.BooleanField(default=False, verbose_name=_(u"E-commerce?")) + #images = models.ManyToManyField('Image', blank=True, null=True, verbose_name=_(u"Imatges")) + + def _is_collective(self): + if self.persons.count() < 2 and self.projects.count() < 2: + return False + else: + return True + _is_collective.boolean = True + _is_collective.short_description = _(u"is collective?") + collective = property(_is_collective) + + #ref_persons = models.ManyToManyField('Person', blank=True, null=True, verbose_name=_(u"Persones de referència")) + + class Meta: + verbose_name= _(u'Project') + verbose_name_plural= _(u'e- Projects') + + def _get_ref_persons(self): + return self.human_persons.filter(relation__clas='reference') + + def _ref_persons(self): + prs = self._get_ref_persons() + if prs.count() > 0: + out = ul_tag + for pr in prs: + out += '
  • '+str(pr)+'
  • ' + return out+'' + return str_none + _ref_persons.allow_tags = True + _ref_persons.short_description = _(u"Reference person?") + + def __str__(self): + if self.nickname is None or self.nickname == '': + if self.project_type: + return self.name+' ('+self.project_type.name+')' + else: + return self.name + else: + return self.nickname+' ('+self.name+')' """ class Project_Type(Being_Type): - projectType_being_type = models.OneToOneField('Being_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name = _(u"Type of Project") - verbose_name_plural = _(u"e-> Types of Projects") + projectType_being_type = models.OneToOneField('Being_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + class Meta: + verbose_name = _(u"Type of Project") + verbose_name_plural = _(u"e-> Types of Projects") """ class Company(Human): - human = models.OneToOneField('Human', primary_key=True, parent_link=True, on_delete=models.CASCADE) - company_type = TreeForeignKey('Company_Type', null=True, blank=True, verbose_name=_(u"Type of company")) - legal_name = models.CharField(max_length=200, blank=True, null=True, verbose_name=_(u"Legal name")) - vat_number = models.CharField(max_length=20, blank=True, null=True, verbose_name=_(u"VAT/CIF")) - class Meta: - verbose_name = _(u"Company") - verbose_name_plural = _(u"e- Companies") + human = models.OneToOneField('Human', primary_key=True, parent_link=True, on_delete=models.CASCADE) + company_type = TreeForeignKey('Company_Type', null=True, blank=True, verbose_name=_(u"Type of company"), on_delete=models.SET_NULL) + legal_name = models.CharField(max_length=200, blank=True, null=True, verbose_name=_(u"Legal name")) + vat_number = models.CharField(max_length=20, blank=True, null=True, verbose_name=_(u"VAT/CIF")) + class Meta: + verbose_name = _(u"Company") + verbose_name_plural = _(u"e- Companies") """ class Company_Type(Being_Type): - companyType_being_type = models.OneToOneField('Being_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name = _(u"Type of Company") - verbose_name_plural = _(u"e-> Types of Companies") + companyType_being_type = models.OneToOneField('Being_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + class Meta: + verbose_name = _(u"Type of Company") + verbose_name_plural = _(u"e-> Types of Companies") """ @python_2_unicode_compatible class rel_Human_Jobs(models.Model): - human = models.ForeignKey('Human') - job = TreeForeignKey('Job', verbose_name=_(u"Job")) - relation = TreeForeignKey('Relation', related_name='hu_job+', blank=True, null=True, verbose_name=_(u"relation")) - class Meta: - verbose_name = _(u"H_job") - verbose_name_plural = _(u"Skills of the entity") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.job.__str__() - else: - return self.relation.gerund+' > '+self.job.__str__() + human = models.ForeignKey('Human', on_delete=models.CASCADE) + job = TreeForeignKey('Job', verbose_name=_(u"Job"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='hu_job+', blank=True, null=True, verbose_name=_(u"relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"H_job") + verbose_name_plural = _(u"Skills of the entity") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.job.__str__() + else: + return self.relation.gerund+' > '+self.job.__str__() @python_2_unicode_compatible class rel_Human_Addresses(models.Model): - human = models.ForeignKey('Human') - address = models.ForeignKey('Address', related_name='rel_human', verbose_name=_(u"Address"), - help_text=_(u"Once choosed the address, save the profile to see the changes.")) - relation = TreeForeignKey('Relation', related_name='hu_adr+', blank=True, null=True, verbose_name=_(u"relation")) - main_address = models.BooleanField(default=False, verbose_name=_(u"Main address?")) - class Meta: - verbose_name = _(u"H_addr") - verbose_name_plural = _(u"Addresses of the entity") - def __str__(self): - if self.relation is None or self.relation.gerund is None or self.relation.gerund == '': - return self.address.__str__() - else: - return self.relation.gerund+' > '+self.address.__str__() - def _is_main(self): - return self.main_address - _is_main.boolean = True - is_main = property(_is_main) - def _selflink(self): - if self.address: - return self.address._selflink() - _selflink.allow_tags = True - _selflink.short_description = '' + human = models.ForeignKey('Human', on_delete=models.CASCADE) + address = models.ForeignKey('Address', related_name='rel_human', verbose_name=_(u"Address"), on_delete=models.CASCADE, + help_text=_(u"Once choosed the address, save the profile to see the changes.")) + relation = TreeForeignKey('Relation', related_name='hu_adr+', blank=True, null=True, verbose_name=_(u"relation"), on_delete=models.CASCADE) + main_address = models.BooleanField(default=False, verbose_name=_(u"Main address?")) + class Meta: + verbose_name = _(u"H_addr") + verbose_name_plural = _(u"Addresses of the entity") + def __str__(self): + if self.relation is None or self.relation.gerund is None or self.relation.gerund == '': + return self.address.__str__() + else: + return self.relation.gerund+' > '+self.address.__str__() + def _is_main(self): + return self.main_address + _is_main.boolean = True + is_main = property(_is_main) + def _selflink(self): + if self.address: + return self.address._selflink() + _selflink.allow_tags = True + _selflink.short_description = '' @python_2_unicode_compatible class rel_Human_Regions(models.Model): - human = models.ForeignKey('Human') - region = TreeForeignKey('Region', verbose_name=_(u"Region")) - relation = TreeForeignKey('Relation', related_name='hu_reg+', blank=True, null=True, verbose_name=_(u"relation")) - class Meta: - verbose_name = _(u"H_reg") - verbose_name_plural = _(u"Related regions") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.region.__str__() - else: - return self.relation.gerund+' > '+self.region.__str__() + human = models.ForeignKey('Human', on_delete=models.CASCADE) + region = TreeForeignKey('Region', verbose_name=_(u"Region"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='hu_reg+', blank=True, null=True, verbose_name=_(u"relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"H_reg") + verbose_name_plural = _(u"Related regions") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.region.__str__() + else: + return self.relation.gerund+' > '+self.region.__str__() @python_2_unicode_compatible class rel_Human_Records(models.Model): - human = models.ForeignKey('Human') - record = models.ForeignKey('Record', verbose_name=_(u"Record")) - relation = TreeForeignKey('Relation', related_name='hu_rec+', blank=True, null=True, verbose_name=_(u"relation")) - class Meta: - verbose_name = _(u"H_rec") - verbose_name_plural = _(u"Related records") - def __str__(self): - if not hasattr(self.relation, 'gerund') or self.relation.gerund is None or self.relation.gerund == '': - return self.record.__str__() - else: - if not hasattr(self.record, 'record_type') or self.record.record_type is None or self.record.record_type == '': - return self.relation.gerund+' > '+self.record.__str__() - return self.record.record_type.name+': '+self.relation.gerund+' > '+self.record.__str__() - def _selflink(self): - return self.record._selflink() - _selflink.allow_tags = True - _selflink.short_description = '' + human = models.ForeignKey('Human', on_delete=models.CASCADE) + record = models.ForeignKey('Record', verbose_name=_(u"Record"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='hu_rec+', blank=True, null=True, verbose_name=_(u"relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"H_rec") + verbose_name_plural = _(u"Related records") + def __str__(self): + if not hasattr(self.relation, 'gerund') or self.relation.gerund is None or self.relation.gerund == '': + return self.record.__str__() + else: + if not hasattr(self.record, 'record_type') or self.record.record_type is None or self.record.record_type == '': + return self.relation.gerund+' > '+self.record.__str__() + return self.record.record_type.name+': '+self.relation.gerund+' > '+self.record.__str__() + def _selflink(self): + return self.record._selflink() + _selflink.allow_tags = True + _selflink.short_description = '' @python_2_unicode_compatible class rel_Human_Materials(models.Model): - human = models.ForeignKey('Human') - material = models.ForeignKey('Material', verbose_name=_(u"Material artwork")) - relation = TreeForeignKey('Relation', related_name='hu_mat+', blank=True, null=True, verbose_name=_(u"relation")) - class Meta: - verbose_name = _(u"H_mat") - verbose_name_plural = _(u"Material Artworks") - def __str__(self): - if not hasattr(self.relation, 'gerund') or self.relation.gerund is None or self.relation.gerund == '': - return self.material.__str__() - else: - return self.relation.gerund+' > '+self.material.__str__() + human = models.ForeignKey('Human', on_delete=models.CASCADE) + material = models.ForeignKey('Material', verbose_name=_(u"Material artwork"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='hu_mat+', blank=True, null=True, verbose_name=_(u"relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"H_mat") + verbose_name_plural = _(u"Material Artworks") + def __str__(self): + if not hasattr(self.relation, 'gerund') or self.relation.gerund is None or self.relation.gerund == '': + return self.material.__str__() + else: + return self.relation.gerund+' > '+self.material.__str__() @python_2_unicode_compatible class rel_Human_Nonmaterials(models.Model): - human = models.ForeignKey('Human') - nonmaterial = models.ForeignKey('Nonmaterial', verbose_name=_(u"Non-material artwork")) - relation = TreeForeignKey('Relation', related_name='hu_non+', blank=True, null=True, verbose_name=_(u"relation")) - class Meta: - verbose_name = _(u"H_inm") - verbose_name_plural = _(u"Non-material Artworks") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.nonmaterial.__str__() - else: - return self.relation.gerund+' > '+self.nonmaterial.__str__() + human = models.ForeignKey('Human', on_delete=models.CASCADE) + nonmaterial = models.ForeignKey('Nonmaterial', verbose_name=_(u"Non-material artwork"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='hu_non+', blank=True, null=True, verbose_name=_(u"relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"H_inm") + verbose_name_plural = _(u"Non-material Artworks") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.nonmaterial.__str__() + else: + return self.relation.gerund+' > '+self.nonmaterial.__str__() @python_2_unicode_compatible class rel_Human_Persons(models.Model): - human = models.ForeignKey('Human', related_name='human_persons') - person = models.ForeignKey('Person', related_name='rel_humans', verbose_name=_(u"Related person")) - relation = TreeForeignKey('Relation', related_name='hu_hum+', blank=True, null=True, verbose_name=_(u"relation")) - class Meta: - verbose_name = _(u"H_per") - verbose_name_plural = _(u"Related persons") - def __str__(self): - if self.relation is None or self.relation.gerund is None or self.relation.gerund == '': - return self.person.__str__() - else: - return self.relation.gerund+' > '+self.person.__str__() - - def _selflink(self): - return self.person._selflink() - _selflink.allow_tags = True - _selflink.short_description = '' + human = models.ForeignKey('Human', related_name='human_persons', on_delete=models.CASCADE) + person = models.ForeignKey('Person', related_name='rel_humans', verbose_name=_(u"Related person"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='hu_hum+', blank=True, null=True, verbose_name=_(u"relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"H_per") + verbose_name_plural = _(u"Related persons") + def __str__(self): + if self.relation is None or self.relation.gerund is None or self.relation.gerund == '': + return self.person.__str__() + else: + return self.relation.gerund+' > '+self.person.__str__() + + def _selflink(self): + return self.person._selflink() + _selflink.allow_tags = True + _selflink.short_description = '' @python_2_unicode_compatible class rel_Human_Projects(models.Model): - human = models.ForeignKey('Human', related_name='human_projects') - project = TreeForeignKey('Project', related_name='rel_humans', verbose_name=_(u"Related project"), - help_text=_(u"Once choosed the project, save the profile to see the changes.")) - relation = TreeForeignKey('Relation', related_name='hu_hum+', blank=True, null=True, verbose_name=_(u"relation")) - class Meta: - verbose_name = _(u"H_pro") - verbose_name_plural = _(u"Related projects") - def __str__(self): - if self.project.project_type is None or self.project.project_type == '': - if self.relation.gerund is None or self.relation.gerund == '': - return self.project.__str__() - else: - return self.relation.gerund+' > '+self.project.__str__() - else: - if not self.relation or self.relation.gerund is None or self.relation.gerund == '': - return '('+self.project.project_type.being_type.name+') rel? > '+self.project.name - else: - return '('+self.project.project_type.being_type.name+') '+self.relation.gerund+' > '+self.project.name + human = models.ForeignKey('Human', related_name='human_projects', on_delete=models.CASCADE) + project = TreeForeignKey('Project', related_name='rel_humans', verbose_name=_(u"Related project"), on_delete=models.CASCADE, + help_text=_(u"Once choosed the project, save the profile to see the changes.")) + relation = TreeForeignKey('Relation', related_name='hu_hum+', blank=True, null=True, verbose_name=_(u"relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"H_pro") + verbose_name_plural = _(u"Related projects") + def __str__(self): + if self.project.project_type is None or self.project.project_type == '': + if self.relation.gerund is None or self.relation.gerund == '': + return self.project.__str__() + else: + return self.relation.gerund+' > '+self.project.__str__() + else: + if not self.relation or self.relation.gerund is None or self.relation.gerund == '': + return '('+self.project.project_type.being_type.name+') rel? > '+self.project.name + else: + return '('+self.project.project_type.being_type.name+') '+self.relation.gerund+' > '+self.project.name @python_2_unicode_compatible class rel_Human_Companies(models.Model): - human= models.ForeignKey('Human', related_name='human_companies') - company = models.ForeignKey('Company', verbose_name=_(u"related Company")) - relation = TreeForeignKey('Relation', related_name='hu_hum+', blank=True, null=True, verbose_name=_(u"relation")) - class Meta: - verbose_name = _(u"H_emp") - verbose_name_plural = _(u"Related companies") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.company.__str__() - else: - return '('+self.company.company_type.being_type.name+') '+self.relation.gerund+' > '+self.company.__str__() + human= models.ForeignKey('Human', related_name='human_companies', on_delete=models.CASCADE) + company = models.ForeignKey('Company', verbose_name=_(u"related Company"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='hu_hum+', blank=True, null=True, verbose_name=_(u"relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"H_emp") + verbose_name_plural = _(u"Related companies") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.company.__str__() + else: + return '('+self.company.company_type.being_type.name+') '+self.relation.gerund+' > '+self.company.__str__() """ ''' class rel_Address_Jobs(models.Model): - address = models.ForeignKey('Address') - job = models.ForeignKey('Job', verbose_name=_(u"Art/Ofici vinculat")) - relation = TreeForeignKey('Relation', related_name='ad_job+', blank=True, null=True) - class Meta: - verbose_name = _(u"job") - verbose_name_plural = _(u"Arts/Oficis vinculats") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.job.__str__() - else: - return self.relation.gerund+' > '+self.job.__str__() + address = models.ForeignKey('Address') + job = models.ForeignKey('Job', verbose_name=_(u"Art/Ofici vinculat")) + relation = TreeForeignKey('Relation', related_name='ad_job+', blank=True, null=True, on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"job") + verbose_name_plural = _(u"Arts/Oficis vinculats") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.job.__str__() + else: + return self.relation.gerund+' > '+self.job.__str__() ''' -# A R T S - (Verbs, Relacions, Arts, Oficis, Sectors...) +# A R T S - (Verbs, Relacions, Arts, Oficis, Sectors...) @python_2_unicode_compatible -class Art(MPTTModel): # Abstract - name = models.CharField(unique=True, max_length=200, verbose_name=_(u"Name"), help_text=_(u"The name of the Art")) - verb = models.CharField(max_length=200, blank=True, verbose_name=_(u"Verb"), help_text=_(u"The verb of the action, infinitive")) - gerund = models.CharField(max_length=200, blank=True, verbose_name=_(u"Gerund"), help_text=_(u"The verb in gerund, present")) - description = models.TextField(blank=True, verbose_name=_(u"Description")) +class Art(MPTTModel): # Abstract + name = models.CharField(unique=True, max_length=200, verbose_name=_(u"Name"), help_text=_(u"The name of the Art")) + verb = models.CharField(max_length=200, blank=True, verbose_name=_(u"Verb"), help_text=_(u"The verb of the action, infinitive")) + gerund = models.CharField(max_length=200, blank=True, verbose_name=_(u"Gerund"), help_text=_(u"The verb in gerund, present")) + description = models.TextField(blank=True, verbose_name=_(u"Description")) - parent = TreeForeignKey('self', null=True, blank=True, related_name='subarts') + parent = TreeForeignKey('self', null=True, blank=True, related_name='subarts', on_delete=models.SET_NULL) - def __str__(self): - if self.verb: - return self.name+', '+self.verb - else: - return self.name + def __str__(self): + if self.verb: + return self.name+', '+self.verb + else: + return self.name - class Meta: + class Meta: - abstract = True + abstract = True - verbose_name = _(u"Art") - verbose_name_plural = _(u"a- Arts") + verbose_name = _(u"Art") + verbose_name_plural = _(u"a- Arts") @python_2_unicode_compatible -class Relation(Art): # Create own ID's (TREE) - #art = models.OneToOneField('Art', primary_key=True, parent_link=True) - clas = models.CharField(blank=True, verbose_name=_(u"Class"), max_length=50, - help_text=_(u"Django model or python class associated to the Relation")) - class Meta: - verbose_name= _(u'Relation') - verbose_name_plural= _(u'a- Relations') - def __str__(self): - if self.verb: - if self.clas is None or self.clas == '': - return self.verb - else: - return self.verb+' ('+self.clas+')' - else: - if self.clas is None or self.clas == '': - return self.name - else: - return self.name+' ('+self.clas+')' +class Relation(Art): # Create own ID's (TREE) + #art = models.OneToOneField('Art', primary_key=True, parent_link=True, on_delete=models.CASCADE) + clas = models.CharField(blank=True, verbose_name=_(u"Class"), max_length=50, + help_text=_(u"Django model or python class associated to the Relation")) + class Meta: + verbose_name= _(u'Relation') + verbose_name_plural= _(u'a- Relations') + def __str__(self): + if self.verb: + if self.clas is None or self.clas == '': + return self.verb + else: + return self.verb+' ('+self.clas+')' + else: + if self.clas is None or self.clas == '': + return self.name + else: + return self.name+' ('+self.clas+')' @python_2_unicode_compatible -class Job(Art): # Create own ID's (TREE) - #art = models.OneToOneField('Art', primary_key=True, parent_link=True) +class Job(Art): # Create own ID's (TREE) + #art = models.OneToOneField('Art', primary_key=True, parent_link=True, on_delete=models.CASCADE) clas = models.CharField(blank=True, verbose_name=_(u"Clas"), max_length=50, help_text=_(u"Django model or python class associated to the Job")) jobs = models.ManyToManyField( 'self', @@ -576,145 +576,145 @@ def __str__(self): @python_2_unicode_compatible class rel_Job_Jobs(models.Model): - job1 = models.ForeignKey('Job', on_delete=models.CASCADE, related_name="rel_jobs1") - job2 = TreeForeignKey('Job', on_delete=models.CASCADE, related_name="rel_jobs2") #, verbose_name=_(u"related Jobs") - relation = TreeForeignKey('Relation', related_name='jo_job+', blank=True, null=True) - class Meta: - verbose_name = _(u"J_job") - verbose_name_plural = _(u"Related jobs") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.job1.__str__() - else: - return '('+self.job1.name+') '+self.relation.gerund+' > '+self.job2.__str__() + job1 = models.ForeignKey('Job', on_delete=models.CASCADE, related_name="rel_jobs1") + job2 = TreeForeignKey('Job', on_delete=models.CASCADE, related_name="rel_jobs2") #, verbose_name=_(u"related Jobs") + relation = TreeForeignKey('Relation', on_delete=models.SET_NULL, related_name='jo_job+', blank=True, null=True) + class Meta: + verbose_name = _(u"J_job") + verbose_name_plural = _(u"Related jobs") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.job1.__str__() + else: + return '('+self.job1.name+') '+self.relation.gerund+' > '+self.job2.__str__() #rel_tit = Relation.objects.get(clas='holder') -# S P A C E S - (Regions, Places, Addresses...) +# S P A C E S - (Regions, Places, Addresses...) @python_2_unicode_compatible -class Space(models.Model): # Abstact - name = models.CharField(verbose_name=_(u"Name"), max_length=100, help_text=_(u"The name of the Space")) - #space_type = TreeForeignKey('Space_Type', blank=True, null=True, verbose_name=_(u"Tipus d'espai")) - #m2 = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) +class Space(models.Model): # Abstact + name = models.CharField(verbose_name=_(u"Name"), max_length=100, help_text=_(u"The name of the Space")) + #space_type = TreeForeignKey('Space_Type', blank=True, null=True, verbose_name=_(u"Tipus d'espai"), on_delete=models.SET_NULL) + #m2 = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) - def __str__(self): - return self.name + def __str__(self): + return self.name - class Meta: - abstract = True + class Meta: + abstract = True class Space_Type(Type): - typ = models.OneToOneField('Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + typ = models.OneToOneField('Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name= _(u"Type of Space") - verbose_name_plural= _(u"s--> Types of Spaces") + class Meta: + verbose_name= _(u"Type of Space") + verbose_name_plural= _(u"s--> Types of Spaces") @python_2_unicode_compatible -class Address(Space): # Create own ID's - #space = models.OneToOneField('Space', primary_key=True, parent_link=True) - address_type = TreeForeignKey('Address_Type', blank=True, null=True, verbose_name=_(u"Type of address")) - p_address = models.CharField(max_length=200, verbose_name=_(u"Address"), help_text=_(u"Postal address able to receive by post")) - town = models.CharField(max_length=150, verbose_name=_(u"Town"), help_text=_(u"Town or City")) - postalcode = models.CharField(max_length=5, blank=True, null=True, verbose_name=_(u"Postal/Zip code")) - region = TreeForeignKey('Region', blank=True, null=True, related_name='rel_addresses', verbose_name=_(u"Region")) - - #telephone = models.CharField(max_length=20, blank=True, verbose_name=_(u"Telefon fix")) - ic_larder = models.BooleanField(default=False, verbose_name=_(u"Is a Larder?")) - #main_address = models.BooleanField(default=False, verbose_name=_(u"Adreça principal?")) - size = models.DecimalField(max_digits=20, decimal_places=2, blank=True, null=True, verbose_name=_(u'Size'), help_text=_(u"Number of units (accept 2 decimals)")) - size_unit = models.ForeignKey('Unit', blank=True, null=True, verbose_name=_(u"Unit of measure")) - longitude = models.IntegerField(blank=True, null=True, verbose_name=_(u"Longitude (geo)")) - latitude = models.IntegerField(blank=True, null=True, verbose_name=_(u"Latitude (geo)")) - - jobs = models.ManyToManyField('Job', related_name='addresses', blank=True, verbose_name=_(u"Related Jobs")) - - description = models.TextField(blank=True, null=True, verbose_name=_(u"Description of the Address"), help_text=_(u"Exact localization, indications to arrive or comments")) - - def _main_addr_of(self): - '''rel = rel_Human_Addresses.objects.filter(address=self, main_address=True).first() #TODO accept various and make a list - if rel: - return rel.human - else:''' - return _(u'nobody') - _main_addr_of.allow_tags = True - _main_addr_of.short_description = _(u"Main address of") - main_addr_of = property(_main_addr_of) - - - class Meta: - verbose_name= _(u'Address') - verbose_name_plural= _(u's- Addresses') - def __str__(self): - return self.name+' ('+self.p_address+' - '+self.town+')' - - def _jobs_list(self): - out = ul_tag - for jo in self.jobs.all(): - out += '
  • '+jo.verb+' - '+erase_id_link('jobs', str(jo.id))+'
  • ' - if out == ul_tag: - return str_none - return out+'' - _jobs_list.allow_tags = True - _jobs_list.short_description = '' - - def _selflink(self): - if self.id: - return a_strG + "address/" + str(self.id) + a_str2 + a_edit +""# % str(self.id) - else: - return "Not present" - _selflink.allow_tags = True +class Address(Space): # Create own ID's + #space = models.OneToOneField('Space', primary_key=True, parent_link=True, on_delete=models.CASCADE) + address_type = TreeForeignKey('Address_Type', blank=True, null=True, verbose_name=_(u"Type of address"), on_delete=models.SET_NULL) + p_address = models.CharField(max_length=200, verbose_name=_(u"Address"), help_text=_(u"Postal address able to receive by post")) + town = models.CharField(max_length=150, verbose_name=_(u"Town"), help_text=_(u"Town or City")) + postalcode = models.CharField(max_length=5, blank=True, null=True, verbose_name=_(u"Postal/Zip code")) + region = TreeForeignKey('Region', blank=True, null=True, related_name='rel_addresses', verbose_name=_(u"Region"), on_delete=models.SET_NULL) + + #telephone = models.CharField(max_length=20, blank=True, verbose_name=_(u"Telefon fix")) + ic_larder = models.BooleanField(default=False, verbose_name=_(u"Is a Larder?")) + #main_address = models.BooleanField(default=False, verbose_name=_(u"Adreça principal?")) + size = models.DecimalField(max_digits=20, decimal_places=2, blank=True, null=True, verbose_name=_(u'Size'), help_text=_(u"Number of units (accept 2 decimals)")) + size_unit = models.ForeignKey('Unit', blank=True, null=True, verbose_name=_(u"Unit of measure"), on_delete=models.SET_NULL) + longitude = models.IntegerField(blank=True, null=True, verbose_name=_(u"Longitude (geo)")) + latitude = models.IntegerField(blank=True, null=True, verbose_name=_(u"Latitude (geo)")) + + jobs = models.ManyToManyField('Job', related_name='addresses', blank=True, verbose_name=_(u"Related Jobs")) + + description = models.TextField(blank=True, null=True, verbose_name=_(u"Description of the Address"), help_text=_(u"Exact localization, indications to arrive or comments")) + + def _main_addr_of(self): + '''rel = rel_Human_Addresses.objects.filter(address=self, main_address=True).first() #TODO accept various and make a list + if rel: + return rel.human + else:''' + return _(u'nobody') + _main_addr_of.allow_tags = True + _main_addr_of.short_description = _(u"Main address of") + main_addr_of = property(_main_addr_of) + + + class Meta: + verbose_name= _(u'Address') + verbose_name_plural= _(u's- Addresses') + def __str__(self): + return self.name+' ('+self.p_address+' - '+self.town+')' + + def _jobs_list(self): + out = ul_tag + for jo in self.jobs.all(): + out += '
  • '+jo.verb+' - '+erase_id_link('jobs', str(jo.id))+'
  • ' + if out == ul_tag: + return str_none + return out+'' + _jobs_list.allow_tags = True + _jobs_list.short_description = '' + + def _selflink(self): + if self.id: + return a_strG + "address/" + str(self.id) + a_str2 + a_edit +""# % str(self.id) + else: + return "Not present" + _selflink.allow_tags = True class Address_Type(Space_Type): - addrTypeSpace_type = models.OneToOneField('Space_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name = _(u"Type of Address") - verbose_name_plural = _(u"s-> Types of Addresses") + addrTypeSpace_type = models.OneToOneField('Space_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + class Meta: + verbose_name = _(u"Type of Address") + verbose_name_plural = _(u"s-> Types of Addresses") -class Region(MPTTModel, Space): # Create own ID's (TREE) - #space = models.OneToOneField('Space', primary_key=True, parent_link=True) - region_type = TreeForeignKey('Region_Type', blank=True, null=True, verbose_name=_(u"Type of region")) - parent = TreeForeignKey('self', null=True, blank=True, related_name='subregions') +class Region(MPTTModel, Space): # Create own ID's (TREE) + #space = models.OneToOneField('Space', primary_key=True, parent_link=True, on_delete=models.CASCADE) + region_type = TreeForeignKey('Region_Type', blank=True, null=True, verbose_name=_(u"Type of region"), on_delete=models.SET_NULL) + parent = TreeForeignKey('self', null=True, blank=True, related_name='subregions', on_delete=models.SET_NULL) - description = models.TextField(blank=True, null=True, verbose_name=_(u"Description of the Region")) + description = models.TextField(blank=True, null=True, verbose_name=_(u"Description of the Region")) - class Meta: - verbose_name= _(u'Region') - verbose_name_plural= _(u's- Regions') + class Meta: + verbose_name= _(u'Region') + verbose_name_plural= _(u's- Regions') class Region_Type(Space_Type): - regionType_space_type = models.OneToOneField('Space_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name = _(u"Type of Region") - verbose_name_plural = _(u"s-> Types of Regions") + regionType_space_type = models.OneToOneField('Space_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + class Meta: + verbose_name = _(u"Type of Region") + verbose_name_plural = _(u"s-> Types of Regions") -# A R T W O R K S - (Obres, Coses, Registres, Documents...) +# A R T W O R K S - (Obres, Coses, Registres, Documents...) @python_2_unicode_compatible -class Artwork(models.Model): # Abstract - name = models.CharField(verbose_name=_(u"Name"), max_length=200, blank=True, null=True) #, help_text=_(u"El nom de la obra (Registre, Unitat, Cosa)")) - #artwork_type = TreeForeignKey('Artwork_Type', blank=True, verbose_name=_(u"Tipus d'Obra")) - description = models.TextField(blank=True, null=True, verbose_name=_(u"Description")) +class Artwork(models.Model): # Abstract + name = models.CharField(verbose_name=_(u"Name"), max_length=200, blank=True, null=True) #, help_text=_(u"El nom de la obra (Registre, Unitat, Cosa)")) + #artwork_type = TreeForeignKey('Artwork_Type', blank=True, verbose_name=_(u"Tipus d'Obra"), on_delete=models.SET_NULL) + description = models.TextField(blank=True, null=True, verbose_name=_(u"Description")) - def __str__(self): - return self.name + def __str__(self): + return self.name - class Meta: - abstract = True + class Meta: + abstract = True class Artwork_Type(Type): - typ = models.OneToOneField('Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name = _(u"Type of Artwork") - verbose_name_plural = _(u"o--> Types of Artworks") + typ = models.OneToOneField('Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + class Meta: + verbose_name = _(u"Type of Artwork") + verbose_name_plural = _(u"o--> Types of Artworks") @@ -722,95 +722,95 @@ class Meta: """ @python_2_unicode_compatible class rel_Nonmaterial_Records(models.Model): - nonmaterial = models.ForeignKey('Nonmaterial') - record = models.ForeignKey('Record', verbose_name=_(u"related Record")) - relation = TreeForeignKey('Relation', related_name='no_reg+', blank=True, null=True) - class Meta: - verbose_name = _(u"N_rec") - verbose_name_plural = _(u"Related records") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.record.__str__() - else: - return '('+self.record.record_type.name+') '+self.relation.gerund+' > '+self.record.__str__() + nonmaterial = models.ForeignKey('Nonmaterial') + record = models.ForeignKey('Record', verbose_name=_(u"related Record")) + relation = TreeForeignKey('Relation', related_name='no_reg+', blank=True, null=True, on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"N_rec") + verbose_name_plural = _(u"Related records") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.record.__str__() + else: + return '('+self.record.record_type.name+') '+self.relation.gerund+' > '+self.record.__str__() @python_2_unicode_compatible class rel_Nonmaterial_Addresses(models.Model): - nonmaterial = models.ForeignKey('Nonmaterial') - address = models.ForeignKey('Address', verbose_name=_(u"related Address")) - relation = TreeForeignKey('Relation', related_name='no_adr+', blank=True, null=True) - class Meta: - verbose_name = _(u"N_adr") - verbose_name_plural = _(u"Related addresses") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.address.__str__() - else: - return '('+self.address.address_type.name+') '+self.relation.gerund+' > '+self.address.__str__() + nonmaterial = models.ForeignKey('Nonmaterial') + address = models.ForeignKey('Address', verbose_name=_(u"related Address")) + relation = TreeForeignKey('Relation', related_name='no_adr+', blank=True, null=True, on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"N_adr") + verbose_name_plural = _(u"Related addresses") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.address.__str__() + else: + return '('+self.address.address_type.name+') '+self.relation.gerund+' > '+self.address.__str__() @python_2_unicode_compatible class rel_Nonmaterial_Jobs(models.Model): - nonmaterial = models.ForeignKey('Nonmaterial') - job = models.ForeignKey('Job', related_name='nonmaterials', verbose_name=_(u"related Arts/Jobs")) - relation = TreeForeignKey('Relation', related_name='no_job+', blank=True, null=True, verbose_name=_(u"Relation")) - class Meta: - verbose_name = _(u"N_ofi") - verbose_name_plural = _(u"Related Arts/Jobs") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.job.__str__() - else: - return self.relation.gerund+' > '+self.job.__str__() + nonmaterial = models.ForeignKey('Nonmaterial') + job = models.ForeignKey('Job', related_name='nonmaterials', verbose_name=_(u"related Arts/Jobs")) + relation = TreeForeignKey('Relation', related_name='no_job+', blank=True, null=True, verbose_name=_(u"Relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"N_ofi") + verbose_name_plural = _(u"Related Arts/Jobs") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.job.__str__() + else: + return self.relation.gerund+' > '+self.job.__str__() @python_2_unicode_compatible class rel_Nonmaterial_Nonmaterials(models.Model): - nonmaterial = models.ForeignKey('Nonmaterial') - nonmaterial2 = models.ForeignKey('Nonmaterial', related_name='subnonmaterials', verbose_name=_(u"related Non-material Artworks")) - relation = TreeForeignKey('Relation', related_name='ma_mat+', blank=True, null=True, verbose_name=_(u"Relation")) - class Meta: - verbose_name = _(u"N_mat") - verbose_name_plural = _(u"related Non-material artworks") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.nonmaterial2.__str__() - else: - return '('+self.nonmaterial2.material_type.name+') '+self.relation.gerund+' > '+self.nonmaterial2.__str__() - - -class Nonmaterial(Artwork): # Create own ID's - nonmaterial_type = TreeForeignKey('Nonmaterial_Type', blank=True, null=True, verbose_name=_(u"Type of non-material artwork")) - - records = models.ManyToManyField('Record', through='rel_Nonmaterial_Records', blank=True, verbose_name=_(u"related Records")) - addresses = models.ManyToManyField('Address', through='rel_Nonmaterial_Addresses', blank=True, verbose_name=_(u"related Addresses")) - jobs = models.ManyToManyField('Job', through='rel_Nonmaterial_Jobs', blank=True, verbose_name=_(u"related Arts/Jobs")) - nonmaterials = models.ManyToManyField('self', through='rel_Nonmaterial_Nonmaterials', symmetrical=False, blank=True, verbose_name=_(u"related Non-material artworks")) - - class Meta: - verbose_name = _(u"Non-material Artwork") - verbose_name_plural = _(u"o- Non-material Artworks") + nonmaterial = models.ForeignKey('Nonmaterial') + nonmaterial2 = models.ForeignKey('Nonmaterial', related_name='subnonmaterials', verbose_name=_(u"related Non-material Artworks")) + relation = TreeForeignKey('Relation', related_name='ma_mat+', blank=True, null=True, verbose_name=_(u"Relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"N_mat") + verbose_name_plural = _(u"related Non-material artworks") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.nonmaterial2.__str__() + else: + return '('+self.nonmaterial2.material_type.name+') '+self.relation.gerund+' > '+self.nonmaterial2.__str__() + + +class Nonmaterial(Artwork): # Create own ID's + nonmaterial_type = TreeForeignKey('Nonmaterial_Type', blank=True, null=True, verbose_name=_(u"Type of non-material artwork"), on_delete=models.SET_NULL) + + records = models.ManyToManyField('Record', through='rel_Nonmaterial_Records', blank=True, verbose_name=_(u"related Records")) + addresses = models.ManyToManyField('Address', through='rel_Nonmaterial_Addresses', blank=True, verbose_name=_(u"related Addresses")) + jobs = models.ManyToManyField('Job', through='rel_Nonmaterial_Jobs', blank=True, verbose_name=_(u"related Arts/Jobs")) + nonmaterials = models.ManyToManyField('self', through='rel_Nonmaterial_Nonmaterials', symmetrical=False, blank=True, verbose_name=_(u"related Non-material artworks")) + + class Meta: + verbose_name = _(u"Non-material Artwork") + verbose_name_plural = _(u"o- Non-material Artworks") """ class Nonmaterial_Type(Artwork_Type): - nonmaterialType_artwork_type = models.OneToOneField('Artwork_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name= _(u"Type of Non-material artwork") - verbose_name_plural= _(u"o-> Types of Non-material artworks") + nonmaterialType_artwork_type = models.OneToOneField('Artwork_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + class Meta: + verbose_name= _(u"Type of Non-material artwork") + verbose_name_plural= _(u"o-> Types of Non-material artworks") """ class Image(Nonmaterial): - image_nonmaterial = models.OneToOneField('Nonmaterial', primary_key=True, parent_link=True, on_delete=models.CASCADE) - image_image = models.ImageField(upload_to='files/images', height_field='height', width_field='width', - blank=True, null=True, - verbose_name=_(u"Image (jpg/png)")) - #footer = models.TextField(blank=True, null=True, verbose_name=_(u"Peu de foto")) - url = models.URLField(blank=True, null=True, verbose_name=_(u"Url of the image")) - height = models.IntegerField(blank=True, null=True, verbose_name=_(u"Height")) - width = models.IntegerField(blank=True, null=True, verbose_name=_(u"Width")) - - class Meta: - verbose_name = _(u"Image") - verbose_name_plural = _(u"o- Images") + image_nonmaterial = models.OneToOneField('Nonmaterial', primary_key=True, parent_link=True, on_delete=models.CASCADE) + image_image = models.ImageField(upload_to='files/images', height_field='height', width_field='width', + blank=True, null=True, + verbose_name=_(u"Image (jpg/png)")) + #footer = models.TextField(blank=True, null=True, verbose_name=_(u"Peu de foto")) + url = models.URLField(blank=True, null=True, verbose_name=_(u"Url of the image")) + height = models.IntegerField(blank=True, null=True, verbose_name=_(u"Height")) + width = models.IntegerField(blank=True, null=True, verbose_name=_(u"Width")) + + class Meta: + verbose_name = _(u"Image") + verbose_name_plural = _(u"o- Images") """ @@ -818,139 +818,139 @@ class Meta: """ @python_2_unicode_compatible class rel_Material_Nonmaterials(models.Model): - material = models.ForeignKey('Material') - nonmaterial = models.ForeignKey('Nonmaterial', verbose_name=_(u"related Non-material")) - relation = TreeForeignKey('Relation', related_name='ma_non+', blank=True, null=True) - class Meta: - verbose_name = _(u"M_inm") - verbose_name_plural = _(u"related Non-materials") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.nonmaterial.__str__() - else: - return '('+self.nonmaterial.nonmaterial_type.name+') '+self.relation.gerund+' > '+self.nonmaterial.__str__() + material = models.ForeignKey('Material', on_delete=models.CASCADE) + nonmaterial = models.ForeignKey('Nonmaterial', verbose_name=_(u"related Non-material"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='ma_non+', blank=True, null=True, on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"M_inm") + verbose_name_plural = _(u"related Non-materials") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.nonmaterial.__str__() + else: + return '('+self.nonmaterial.nonmaterial_type.name+') '+self.relation.gerund+' > '+self.nonmaterial.__str__() @python_2_unicode_compatible class rel_Material_Records(models.Model): - material = models.ForeignKey('Material') - record = models.ForeignKey('Record', verbose_name=_(u"related Record")) - relation = TreeForeignKey('Relation', related_name='ma_reg+', blank=True, null=True) - class Meta: - verbose_name = _(u"M_rec") - verbose_name_plural = _(u"related Records") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.record.__str__() - else: - return '('+self.record.record_type.name+') '+self.relation.gerund+' > '+self.record.__str__() + material = models.ForeignKey('Material', on_delete=models.CASCADE) + record = models.ForeignKey('Record', verbose_name=_(u"related Record"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='ma_reg+', blank=True, null=True, on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"M_rec") + verbose_name_plural = _(u"related Records") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.record.__str__() + else: + return '('+self.record.record_type.name+') '+self.relation.gerund+' > '+self.record.__str__() @python_2_unicode_compatible class rel_Material_Addresses(models.Model): - material = models.ForeignKey('Material') - address = models.ForeignKey('Address', related_name='materials', verbose_name=_(u"related Address")) - relation = TreeForeignKey('Relation', related_name='ma_adr+', blank=True, null=True) - class Meta: - verbose_name = _(u"M_adr") - verbose_name_plural = _(u"related Addresses") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.address.__str__() - else: - return '('+self.address.address_type.name+') '+self.relation.gerund+' > '+self.address.__str__() + material = models.ForeignKey('Material', on_delete=models.CASCADE) + address = models.ForeignKey('Address', related_name='materials', verbose_name=_(u"related Address"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='ma_adr+', blank=True, null=True, on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"M_adr") + verbose_name_plural = _(u"related Addresses") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.address.__str__() + else: + return '('+self.address.address_type.name+') '+self.relation.gerund+' > '+self.address.__str__() @python_2_unicode_compatible class rel_Material_Materials(models.Model): - material = models.ForeignKey('Material') - material2 = models.ForeignKey('Material', related_name='submaterials', verbose_name=_(u"related Material artworks")) - relation = TreeForeignKey('Relation', related_name='ma_mat+', blank=True, null=True, verbose_name=_(u"Relation")) - class Meta: - verbose_name = _(u"M_mat") - verbose_name_plural = _(u"related Material artworks") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.material2.__str__() - else: - return '('+self.material2.material_type.name+') '+self.relation.gerund+' > '+self.material2.__str__() + material = models.ForeignKey('Material', on_delete=models.CASCADE) + material2 = models.ForeignKey('Material', related_name='submaterials', verbose_name=_(u"related Material artworks"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='ma_mat+', blank=True, null=True, verbose_name=_(u"Relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"M_mat") + verbose_name_plural = _(u"related Material artworks") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.material2.__str__() + else: + return '('+self.material2.material_type.name+') '+self.relation.gerund+' > '+self.material2.__str__() @python_2_unicode_compatible class rel_Material_Jobs(models.Model): - material = models.ForeignKey('Material') - job = models.ForeignKey('Job', related_name='materials', verbose_name=_(u"related Arts/Jobs")) - relation = TreeForeignKey('Relation', related_name='ma_job+', blank=True, null=True, verbose_name=_(u"Relation")) - class Meta: - verbose_name = _(u"M_ofi") - verbose_name_plural = _(u"related Arts/Jobs") - def __str__(self): - if self.relation.gerund is None or self.relation.gerund == '': - return self.job.__str__() - else: - return self.relation.gerund+' > '+self.job.__str__() + material = models.ForeignKey('Material', on_delete=models.CASCADE, on_delete=models.CASCADE) + job = models.ForeignKey('Job', related_name='materials', verbose_name=_(u"related Arts/Jobs"), on_delete=models.CASCADE) + relation = TreeForeignKey('Relation', related_name='ma_job+', blank=True, null=True, verbose_name=_(u"Relation"), on_delete=models.SET_NULL) + class Meta: + verbose_name = _(u"M_ofi") + verbose_name_plural = _(u"related Arts/Jobs") + def __str__(self): + if self.relation.gerund is None or self.relation.gerund == '': + return self.job.__str__() + else: + return self.relation.gerund+' > '+self.job.__str__() class Material(Artwork): # Create own ID's - material_type = TreeForeignKey('Material_Type', blank=True, null=True, verbose_name=_(u"Type of physical artwork")) - - nonmaterials = models.ManyToManyField('Nonmaterial', through='rel_Material_Nonmaterials', blank=True, verbose_name=_(u"related Non-materials")) - records = models.ManyToManyField('Record', through='rel_Material_Records', blank=True, verbose_name=_(u"related Records")) - addresses = models.ManyToManyField('Address', through='rel_Material_Addresses', blank=True, verbose_name=_(u"related Addresses")) - materials = models.ManyToManyField('self', through='rel_Material_Materials', symmetrical=False, blank=True, verbose_name=_(u"related Material artworks")) - jobs = models.ManyToManyField('Job', through='rel_Material_Jobs', blank=True, verbose_name=_(u"related Arts/Jobs")) - - class Meta: - verbose_name = _(u"Material Artwork") - verbose_name_plural = _(u"o- Material Artworks") - - def _addresses_list(self): - out = ul_tag - print(self.addresses.all()) - if self.addresses.all().count() > 0: - for add in self.addresses.all(): - rel = add.materials.filter(material=self).first().relation - out += '
  • '+rel.gerund+': '+add.__str__()+'
  • ' - return out+'' - return str_none - _addresses_list.allow_tags = True - _addresses_list.short_description = _(u"related Addresses?") - - def _jobs_list(self): - out = ul_tag - print(self.jobs.all()) - if self.jobs.all().count() > 0: - for job in self.jobs.all(): - rel = job.materials.filter(material=self).first().relation - out += '
  • '+rel.gerund+': '+job.__str__()+'
  • ' - return out+'' - return str_none - _jobs_list.allow_tags = True - _jobs_list.short_description = _(u"related Arts/Jobs?") + material_type = TreeForeignKey('Material_Type', blank=True, null=True, verbose_name=_(u"Type of physical artwork"), on_delete=models.SET_NULL) + + nonmaterials = models.ManyToManyField('Nonmaterial', through='rel_Material_Nonmaterials', blank=True, verbose_name=_(u"related Non-materials")) + records = models.ManyToManyField('Record', through='rel_Material_Records', blank=True, verbose_name=_(u"related Records")) + addresses = models.ManyToManyField('Address', through='rel_Material_Addresses', blank=True, verbose_name=_(u"related Addresses")) + materials = models.ManyToManyField('self', through='rel_Material_Materials', symmetrical=False, blank=True, verbose_name=_(u"related Material artworks")) + jobs = models.ManyToManyField('Job', through='rel_Material_Jobs', blank=True, verbose_name=_(u"related Arts/Jobs")) + + class Meta: + verbose_name = _(u"Material Artwork") + verbose_name_plural = _(u"o- Material Artworks") + + def _addresses_list(self): + out = ul_tag + print(self.addresses.all()) + if self.addresses.all().count() > 0: + for add in self.addresses.all(): + rel = add.materials.filter(material=self).first().relation + out += '
  • '+rel.gerund+': '+add.__str__()+'
  • ' + return out+'' + return str_none + _addresses_list.allow_tags = True + _addresses_list.short_description = _(u"related Addresses?") + + def _jobs_list(self): + out = ul_tag + print(self.jobs.all()) + if self.jobs.all().count() > 0: + for job in self.jobs.all(): + rel = job.materials.filter(material=self).first().relation + out += '
  • '+rel.gerund+': '+job.__str__()+'
  • ' + return out+'' + return str_none + _jobs_list.allow_tags = True + _jobs_list.short_description = _(u"related Arts/Jobs?") """ class Material_Type(Artwork_Type): - materialType_artwork_type = models.OneToOneField('Artwork_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name= _(u"Type of Material artwork") - verbose_name_plural= _(u"o-> Types of Material artworks") + materialType_artwork_type = models.OneToOneField('Artwork_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + class Meta: + verbose_name= _(u"Type of Material artwork") + verbose_name_plural= _(u"o-> Types of Material artworks") """ @python_2_unicode_compatible class Asset(Material): - asset_material = models.OneToOneField('Material', primary_key=True, parent_link=True, on_delete=models.CASCADE) - asset_human = models.ForeignKey('Human', verbose_name=_(u"Entity")) - reciprocity = models.TextField(blank=True, verbose_name=_(u"Reciprocity")) - class Meta: - verbose_name = _(u"Asset") - verbose_name_plural = _(u"o- Assets") - def __str__(self): - return '('+self.material_type.name+') '+self.material.name - - def _selflink(self): - if self.id: - return a_strG + "asset/" + str(self.id) + a_str2 + a_edit +""# % str(self.id) - else: - return "Not present" - _selflink.allow_tags = True - _selflink.short_description = '' + asset_material = models.OneToOneField('Material', primary_key=True, parent_link=True, on_delete=models.CASCADE) + asset_human = models.ForeignKey('Human', verbose_name=_(u"Entity"), on_delete=models.CASCADE) + reciprocity = models.TextField(blank=True, verbose_name=_(u"Reciprocity")) + class Meta: + verbose_name = _(u"Asset") + verbose_name_plural = _(u"o- Assets") + def __str__(self): + return '('+self.material_type.name+') '+self.material.name + + def _selflink(self): + if self.id: + return a_strG + "asset/" + str(self.id) + a_str2 + a_edit +""# % str(self.id) + else: + return "Not present" + _selflink.allow_tags = True + _selflink.short_description = '' """ @@ -959,18 +959,18 @@ def _selflink(self): from valuenetwork.valueaccounting.models import Unit as Ocp_Unit @python_2_unicode_compatible -class Unit(Artwork): # Create own ID's - unit_type = TreeForeignKey('Unit_Type', blank=True, null=True, verbose_name=_(u"Type of Unit")) +class Unit(Artwork): # Create own ID's + unit_type = TreeForeignKey('Unit_Type', blank=True, null=True, verbose_name=_(u"Type of Unit"), on_delete=models.SET_NULL) code = models.CharField(max_length=4, verbose_name=_(u"Code or Symbol")) - region = TreeForeignKey('Region', blank=True, null=True, verbose_name=_(u"related use Region")) + region = TreeForeignKey('Region', blank=True, null=True, verbose_name=_(u"related use Region"), on_delete=models.SET_NULL) #human = models.ForeignKey('Human', blank=True, null=True, verbose_name=_(u"related Entity")) - ocp_unit = models.OneToOneField(Ocp_Unit, blank=True, null=True, verbose_name=_(u"OCP Unit"), related_name="gen_unit") + ocp_unit = models.OneToOneField(Ocp_Unit, blank=True, null=True, verbose_name=_(u"OCP Unit"), related_name="gen_unit", on_delete=models.SET_NULL) class Meta: - verbose_name= _(u'Unit') - verbose_name_plural= _(u'o- Units') + verbose_name= _(u'Unit') + verbose_name_plural= _(u'o- Units') def __str__(self): if hasattr(self, 'ocp_unit') and self.ocp_unit: @@ -979,109 +979,109 @@ def __str__(self): return self.unit_type.name+': '+self.name class Unit_Type(Artwork_Type): - unitType_artwork_type = models.OneToOneField('Artwork_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + unitType_artwork_type = models.OneToOneField('Artwork_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name = _(u"Type of Unit") - verbose_name_plural = _(u"o-> Types of Units") + class Meta: + verbose_name = _(u"Type of Unit") + verbose_name_plural = _(u"o-> Types of Units") # - - - - - R E C O R D @python_2_unicode_compatible -class Record(Artwork): # Create own ID's - record_type = TreeForeignKey('Record_Type', blank=True, null=True, verbose_name=_(u"Type of Record")) - class Meta: - verbose_name= _(u'Record') - verbose_name_plural= _(u'o- Records') - def __str__(self): - if self.record_type is None or self.record_type == '': - return self.name - else: - return self.record_type.name+': '+self.name - - def _selflink(self): - if self.id: - return a_strG + "record/" + str(self.id) + a_str2 + a_edit +""# % str(self.id) - else: - return "Not present" - _selflink.allow_tags = True +class Record(Artwork): # Create own ID's + record_type = TreeForeignKey('Record_Type', blank=True, null=True, verbose_name=_(u"Type of Record"), on_delete=models.SET_NULL) + class Meta: + verbose_name= _(u'Record') + verbose_name_plural= _(u'o- Records') + def __str__(self): + if self.record_type is None or self.record_type == '': + return self.name + else: + return self.record_type.name+': '+self.name + + def _selflink(self): + if self.id: + return a_strG + "record/" + str(self.id) + a_str2 + a_edit +""# % str(self.id) + else: + return "Not present" + _selflink.allow_tags = True class Record_Type(Artwork_Type): - recordType_artwork_type = models.OneToOneField('Artwork_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) - class Meta: - verbose_name= _(u'Type of Record') - verbose_name_plural= _(u'o-> Types of Records') + recordType_artwork_type = models.OneToOneField('Artwork_Type', primary_key=True, parent_link=True, on_delete=models.CASCADE) + class Meta: + verbose_name= _(u'Type of Record') + verbose_name_plural= _(u'o-> Types of Records') @python_2_unicode_compatible class UnitRatio(Record): - record = models.OneToOneField('Record', primary_key=True, parent_link=True, on_delete=models.CASCADE) + record = models.OneToOneField('Record', primary_key=True, parent_link=True, on_delete=models.CASCADE) - in_unit = models.ForeignKey('Unit', related_name='ratio_in', verbose_name=_(u"in Unit")) - rate = models.DecimalField(max_digits=10, decimal_places=4, verbose_name=_(u"Ratio multiplier")) - out_unit = models.ForeignKey('Unit', related_name='ratio_out', verbose_name=_(u"out Unit")) - class Meta: - verbose_name = _(u"Equivalence between Units") - verbose_name_plural = _(u"o- Equivalences between Units") - def __str__(self): - return self.in_unit.name+' * '+str(self.rate)+' = '+self.out_unit.name + in_unit = models.ForeignKey('Unit', related_name='ratio_in', verbose_name=_(u"in Unit"), on_delete=models.CASCADE) + rate = models.DecimalField(max_digits=10, decimal_places=4, verbose_name=_(u"Ratio multiplier")) + out_unit = models.ForeignKey('Unit', related_name='ratio_out', verbose_name=_(u"out Unit"), on_delete=models.CASCADE) + class Meta: + verbose_name = _(u"Equivalence between Units") + verbose_name_plural = _(u"o- Equivalences between Units") + def __str__(self): + return self.in_unit.name+' * '+str(self.rate)+' = '+self.out_unit.name """ @python_2_unicode_compatible class AccountCes(Record): - record = models.OneToOneField('Record', primary_key=True, parent_link=True, on_delete=models.CASCADE) + record = models.OneToOneField('Record', primary_key=True, parent_link=True, on_delete=models.CASCADE) - accCes_human = models.ForeignKey('Human', related_name='accountsCes', verbose_name=_(u"Owner human entity")) - entity = models.ForeignKey('Project', verbose_name=_(u"Network of the account")) - unit = models.ForeignKey('Unit', verbose_name=_(u"Unit (currency)")) - code = models.CharField(max_length=10, blank=True, null=True, verbose_name=_(u"Network code")) - number = models.CharField(max_length=4, blank=True, null=True, verbose_name=_(u"Account number")) + accCes_human = models.ForeignKey('Human', related_name='accountsCes', verbose_name=_(u"Owner human entity"), on_delete=models.CASCADE) + entity = models.ForeignKey('Project', verbose_name=_(u"Network of the account"), on_delete=models.CASCADE) + unit = models.ForeignKey('Unit', verbose_name=_(u"Unit (currency)"), on_delete=models.CASCADE) + code = models.CharField(max_length=10, blank=True, null=True, verbose_name=_(u"Network code")) + number = models.CharField(max_length=4, blank=True, null=True, verbose_name=_(u"Account number")) - class Meta: - verbose_name= _(u'CES Account') - verbose_name_plural= _(u'o- CES Accounts') + class Meta: + verbose_name= _(u'CES Account') + verbose_name_plural= _(u'o- CES Accounts') - def __str__(self): - return '('+self.unit.code+') '+self.accCes_human.nickname + ' ' + self.code + self.number#+' '+self.name + def __str__(self): + return '('+self.unit.code+') '+self.accCes_human.nickname + ' ' + self.code + self.number#+' '+self.name @python_2_unicode_compatible class AccountBank(Record): - record = models.OneToOneField('Record', primary_key=True, parent_link=True, on_delete=models.CASCADE) + record = models.OneToOneField('Record', primary_key=True, parent_link=True, on_delete=models.CASCADE) - accBnk_human = models.ForeignKey('Human', related_name='accountsBank', verbose_name=_(u"Owner human entity")) - company = models.ForeignKey('Company', blank=True, null=True, verbose_name=_(u"Bank entity")) - unit = models.ForeignKey('Unit', blank=True, null=True, verbose_name=_(u"Unit (currency)")) - code = models.CharField(max_length=11, blank=True, null=True, verbose_name=_(u"SWIFT/BIC Code")) - number = models.CharField(max_length=34, blank=True, null=True, verbose_name=_(u"IBAN Account number")) - bankcard = models.BooleanField(default=False, verbose_name=_(u"with bank Card?")) + accBnk_human = models.ForeignKey('Human', related_name='accountsBank', verbose_name=_(u"Owner human entity"), on_delete=models.CASCADE) + company = models.ForeignKey('Company', blank=True, null=True, verbose_name=_(u"Bank entity"), on_delete=models.SET_NULL) + unit = models.ForeignKey('Unit', blank=True, null=True, verbose_name=_(u"Unit (currency)"), on_delete=models.SET_NULL) + code = models.CharField(max_length=11, blank=True, null=True, verbose_name=_(u"SWIFT/BIC Code")) + number = models.CharField(max_length=34, blank=True, null=True, verbose_name=_(u"IBAN Account number")) + bankcard = models.BooleanField(default=False, verbose_name=_(u"with bank Card?")) - class Meta: - verbose_name= _(u'Bank Account') - verbose_name_plural= _(u'o- Bank Accounts') + class Meta: + verbose_name= _(u'Bank Account') + verbose_name_plural= _(u'o- Bank Accounts') - def __str__(self): - try: - return '('+self.unit.code+') '+self.company.nickname+': '+self.accBnk_human.nickname + ' ' + self.number - except: - return "" + def __str__(self): + try: + return '('+self.unit.code+') '+self.company.nickname+': '+self.accBnk_human.nickname + ' ' + self.number + except: + return "" @python_2_unicode_compatible class AccountCrypto(Record): - record = models.OneToOneField('Record', primary_key=True, parent_link=True, on_delete=models.CASCADE) - accCrypt_human = models.ForeignKey('Human', related_name='accountsCrypto', verbose_name=_(u"Owner human entity")) - unit = models.ForeignKey('Unit', verbose_name=_(u"Unit (currency)")) - number = models.CharField(max_length=34, blank=True, verbose_name=_(u"Address of the wallet")) - class Meta: - verbose_name = _(u"Cryptocurrency Account") - verbose_name_plural = _(u"o- Cryptocurrency Accounts") - - def __str__(self): - return '('+self.unit.code+') '+self.accCrypt_human.nickname + ' ' + self.number # +' '+self.name + record = models.OneToOneField('Record', primary_key=True, parent_link=True, on_delete=models.CASCADE) + accCrypt_human = models.ForeignKey('Human', related_name='accountsCrypto', verbose_name=_(u"Owner human entity"), on_delete=models.CASCADE) + unit = models.ForeignKey('Unit', verbose_name=_(u"Unit (currency)"), on_delete=models.CASCADE) + number = models.CharField(max_length=34, blank=True, verbose_name=_(u"Address of the wallet")) + class Meta: + verbose_name = _(u"Cryptocurrency Account") + verbose_name_plural = _(u"o- Cryptocurrency Accounts") + + def __str__(self): + return '('+self.unit.code+') '+self.accCrypt_human.nickname + ' ' + self.number # +' '+self.name """ diff --git a/validation/models.py b/validation/models.py index 727b0da9e..298e103d1 100644 --- a/validation/models.py +++ b/validation/models.py @@ -6,9 +6,9 @@ class Validation(models.Model): event = models.ForeignKey(EconomicEvent, - related_name="validations") + related_name="validations", on_delete=models.CASCADE) validated_by = models.ForeignKey(EconomicAgent, - related_name="validations") + related_name="validations", on_delete=models.CASCADE) validation_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) note = models.TextField(blank=True, null=True) diff --git a/valuenetwork/api/models.py b/valuenetwork/api/models.py index f4d8f5173..5753318d9 100644 --- a/valuenetwork/api/models.py +++ b/valuenetwork/api/models.py @@ -39,7 +39,7 @@ def formatAgentList(agent_list): class QuantityValue(models.Model): numeric_value = models.DecimalField(max_digits=8, decimal_places=2, default=Decimal("0.00")) - unit = models.ForeignKey(Unit, blank=True, null=True, + unit = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, related_name="quantity_value_units") class Meta: @@ -88,7 +88,7 @@ class Fulfillment(models.Model): on_delete=models.DO_NOTHING) fulfills = models.ForeignKey(Commitment, related_name="fulfillments", - on_delete=models.DO_NOTHING) + on_delete=models.DO_NOTHING) fulfilled_quantity = models.ForeignKey(QuantityValue, related_name="fulfillments", on_delete=models.DO_NOTHING) diff --git a/valuenetwork/valueaccounting/migrations/0001_initial.py b/valuenetwork/valueaccounting/migrations/0001_initial.py index 1db45b776..d424807be 100644 --- a/valuenetwork/valueaccounting/migrations/0001_initial.py +++ b/valuenetwork/valueaccounting/migrations/0001_initial.py @@ -102,7 +102,7 @@ class Migration(migrations.Migration): ('party_type', models.CharField(default=b'individual', max_length=12, verbose_name='party type', choices=[(b'individual', 'individual'), (b'org', 'organization'), (b'network', 'network'), (b'team', 'project'), (b'community', 'community')])), ('description', models.TextField(null=True, verbose_name='description', blank=True)), ('is_context', models.BooleanField(default=False, verbose_name='is context')), - ('parent', models.ForeignKey(related_name='sub-agents', blank=True, editable=False, to='valueaccounting.AgentType', null=True, verbose_name='parent')), + ('parent', models.ForeignKey(related_name='sub-agents', blank=True, editable=False, to='valueaccounting.AgentType', null=True, verbose_name='parent', on_delete=models.SET_NULL)), ], options={ 'ordering': ('name',), @@ -155,7 +155,7 @@ class Migration(migrations.Migration): ('claim_event_date', models.DateField(default=datetime.date.today, verbose_name='claim event date')), ('value', models.DecimalField(verbose_name='value', max_digits=8, decimal_places=2)), ('event_effect', models.CharField(max_length=12, verbose_name='event effect', choices=[(b'+', 'increase'), (b'-', 'decrease')])), - ('claim', models.ForeignKey(related_name='claim_events', verbose_name='claims', to='valueaccounting.Claim')), + ('claim', models.ForeignKey(related_name='claim_events', verbose_name='claims', to='valueaccounting.Claim', on_delete=models.CASCADE)), ], options={ 'ordering': ('claim_event_date',), @@ -178,7 +178,7 @@ class Migration(migrations.Migration): ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), ('slug', models.SlugField(verbose_name='Page name', editable=False)), - ('changed_by', models.ForeignKey(related_name='commitments_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), + ('changed_by', models.ForeignKey(related_name='commitments_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), ], options={ 'ordering': ('due_date',), @@ -197,7 +197,7 @@ class Migration(migrations.Migration): ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), ('slug', models.SlugField(verbose_name='Page name', editable=False)), - ('changed_by', models.ForeignKey(related_name='distributions_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), + ('changed_by', models.ForeignKey(related_name='distributions_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), ], options={ 'ordering': ('-distribution_date',), @@ -237,9 +237,9 @@ class Migration(migrations.Migration): ('slug', models.SlugField(verbose_name='Page name', editable=False)), ('created_date', models.DateField(default=datetime.date.today, verbose_name='created date')), ('changed_date', models.DateField(auto_now=True, null=True)), - ('agent_type', models.ForeignKey(related_name='agents', verbose_name='agent type', to='valueaccounting.AgentType')), - ('changed_by', models.ForeignKey(related_name='agents_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('created_by', models.ForeignKey(related_name='agents_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), + ('agent_type', models.ForeignKey(related_name='agents', verbose_name='agent type', to='valueaccounting.AgentType', on_delete=models.CASCADE)), + ('changed_by', models.ForeignKey(related_name='agents_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='agents_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), ], options={ 'ordering': ('nick',), @@ -263,11 +263,11 @@ class Migration(migrations.Migration): ('digital_currency_tx_hash', models.CharField(verbose_name='digital currency transaction hash', max_length=96, null=True, editable=False, blank=True)), ('digital_currency_tx_state', models.CharField(editable=False, choices=[(b'new', 'New'), (b'pending', 'Pending'), (b'broadcast', 'Broadcast'), (b'confirmed', 'Confirmed')], max_length=12, blank=True, null=True, verbose_name='digital currency transaction hash')), ('slug', models.SlugField(verbose_name='Page name', editable=False)), - ('accounting_reference', models.ForeignKey(related_name='events', blank=True, to='valueaccounting.AccountingReference', help_text='optional reference to an accounting grouping', null=True, verbose_name='accounting reference')), - ('changed_by', models.ForeignKey(related_name='events_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), + ('accounting_reference', models.ForeignKey(related_name='events', blank=True, to='valueaccounting.AccountingReference', help_text='optional reference to an accounting grouping', null=True, verbose_name='accounting reference', on_delete=models.SET_NULL)), + ('changed_by', models.ForeignKey(related_name='events_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), ('commitment', models.ForeignKey(related_name='fulfillment_events', on_delete=django.db.models.deletion.SET_NULL, verbose_name='fulfills commitment', blank=True, to='valueaccounting.Commitment', null=True)), ('context_agent', models.ForeignKey(related_name='events', on_delete=django.db.models.deletion.SET_NULL, verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True)), - ('created_by', models.ForeignKey(related_name='events_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), + ('created_by', models.ForeignKey(related_name='events_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), ('distribution', models.ForeignKey(related_name='events', on_delete=django.db.models.deletion.SET_NULL, verbose_name='distribution', blank=True, to='valueaccounting.Distribution', null=True)), ], options={ @@ -293,9 +293,9 @@ class Migration(migrations.Migration): ('price_per_unit', models.DecimalField(default=Decimal('0.00'), verbose_name='price per unit', max_digits=8, decimal_places=2)), ('created_date', models.DateField(default=datetime.date.today, verbose_name='created date')), ('changed_date', models.DateField(auto_now=True, null=True)), - ('author', models.ForeignKey(related_name='authored_resources', verbose_name='author', blank=True, to='valueaccounting.EconomicAgent', null=True)), - ('changed_by', models.ForeignKey(related_name='resources_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('created_by', models.ForeignKey(related_name='resources_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), + ('author', models.ForeignKey(related_name='authored_resources', verbose_name='author', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), + ('changed_by', models.ForeignKey(related_name='resources_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='resources_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), ], options={ 'ordering': ('resource_type', 'identifier'), @@ -320,10 +320,10 @@ class Migration(migrations.Migration): ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), ('slug', models.SlugField(verbose_name='Page name', editable=False)), - ('accounting_reference', models.ForeignKey(related_name='resource_types', blank=True, to='valueaccounting.AccountingReference', help_text='optional reference to an external account', null=True, verbose_name='accounting reference')), - ('changed_by', models.ForeignKey(related_name='resource_types_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('created_by', models.ForeignKey(related_name='resource_types_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('parent', models.ForeignKey(related_name='children', verbose_name='parent', blank=True, to='valueaccounting.EconomicResourceType', null=True)), + ('accounting_reference', models.ForeignKey(related_name='resource_types', blank=True, to='valueaccounting.AccountingReference', help_text='optional reference to an external account', null=True, verbose_name='accounting reference', on_delete=models.SET_NULL)), + ('changed_by', models.ForeignKey(related_name='resource_types_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='resource_types_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('parent', models.ForeignKey(related_name='children', verbose_name='parent', blank=True, to='valueaccounting.EconomicResourceType', null=True, on_delete=models.SET_NULL)), ], options={ 'ordering': ('name',), @@ -360,10 +360,10 @@ class Migration(migrations.Migration): ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), ('slug', models.SlugField(verbose_name='Page name', editable=False)), - ('changed_by', models.ForeignKey(related_name='exchanges_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('context_agent', models.ForeignKey(related_name='exchanges', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True)), - ('created_by', models.ForeignKey(related_name='exchanges_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('customer', models.ForeignKey(related_name='exchanges_as_customer', verbose_name='customer', blank=True, to='valueaccounting.EconomicAgent', null=True)), + ('changed_by', models.ForeignKey(related_name='exchanges_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('context_agent', models.ForeignKey(related_name='exchanges', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='exchanges_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('customer', models.ForeignKey(related_name='exchanges_as_customer', verbose_name='customer', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), ], options={ 'ordering': ('-start_date',), @@ -380,8 +380,8 @@ class Migration(migrations.Migration): ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), ('slug', models.SlugField(verbose_name='Page name', editable=False)), - ('changed_by', models.ForeignKey(related_name='exchange_types_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('created_by', models.ForeignKey(related_name='exchange_types_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), + ('changed_by', models.ForeignKey(related_name='exchange_types_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='exchange_types_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), ], options={ 'ordering': ('name',), @@ -406,7 +406,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('value', models.CharField(max_length=32, verbose_name='value')), ('description', models.TextField(null=True, verbose_name='description', blank=True)), - ('facet', models.ForeignKey(related_name='values', verbose_name='facet', to='valueaccounting.Facet')), + ('facet', models.ForeignKey(related_name='values', verbose_name='facet', to='valueaccounting.Facet', on_delete=models.CASCADE)), ], options={ 'ordering': ('facet', 'value'), @@ -421,9 +421,9 @@ class Migration(migrations.Migration): ('quantity', models.DecimalField(default=Decimal('0.00'), verbose_name='quantity', max_digits=8, decimal_places=2)), ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), - ('changed_by', models.ForeignKey(related_name='features_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('created_by', models.ForeignKey(related_name='features_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('event_type', models.ForeignKey(related_name='features', verbose_name='event type', to='valueaccounting.EventType')), + ('changed_by', models.ForeignKey(related_name='features_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='features_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('event_type', models.ForeignKey(related_name='features', verbose_name='event type', to='valueaccounting.EventType', on_delete=models.CASCADE)), ], options={ 'ordering': ('name',), @@ -470,9 +470,9 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('distribution_date', models.DateField(verbose_name='distribution date')), ('quantity', models.DecimalField(default=Decimal('0.0'), verbose_name='quantity', max_digits=8, decimal_places=2)), - ('distribution', models.ForeignKey(related_name='cash_receipts', default=None, blank=True, to='valueaccounting.Exchange', null=True, verbose_name='distribution')), - ('distribution_ref', models.ForeignKey(related_name='income_events', verbose_name='distribution', blank=True, to='valueaccounting.Distribution', null=True)), - ('income_event', models.ForeignKey(related_name='distributions', verbose_name='income event', to='valueaccounting.EconomicEvent')), + ('distribution', models.ForeignKey(related_name='cash_receipts', default=None, blank=True, to='valueaccounting.Exchange', null=True, verbose_name='distribution', on_delete=models.SET_NULL)), + ('distribution_ref', models.ForeignKey(related_name='income_events', verbose_name='distribution', blank=True, to='valueaccounting.Distribution', null=True, on_delete=models.SET_NULL)), + ('income_event', models.ForeignKey(related_name='distributions', verbose_name='income event', to='valueaccounting.EconomicEvent', on_delete=models.CASCADE)), ], options={ }, @@ -498,10 +498,10 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), - ('changed_by', models.ForeignKey(related_name='options_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('component', models.ForeignKey(related_name='options', verbose_name='component', to='valueaccounting.EconomicResourceType')), - ('created_by', models.ForeignKey(related_name='options_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('feature', models.ForeignKey(related_name='options', verbose_name='feature', to='valueaccounting.Feature')), + ('changed_by', models.ForeignKey(related_name='options_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('component', models.ForeignKey(related_name='options', verbose_name='component', to='valueaccounting.EconomicResourceType', on_delete=models.CASCADE)), + ('created_by', models.ForeignKey(related_name='options_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('feature', models.ForeignKey(related_name='options', verbose_name='feature', to='valueaccounting.Feature', on_delete=models.CASCADE)), ], options={ 'ordering': ('component',), @@ -519,10 +519,10 @@ class Migration(migrations.Migration): ('description', models.TextField(null=True, verbose_name='description', blank=True)), ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), - ('changed_by', models.ForeignKey(related_name='orders_changed', verbose_name='changed by', blank=True, to=settings.AUTH_USER_MODEL, null=True)), - ('created_by', models.ForeignKey(related_name='orders_created', verbose_name='created by', blank=True, to=settings.AUTH_USER_MODEL, null=True)), - ('provider', models.ForeignKey(related_name='sales_orders', verbose_name='provider', blank=True, to='valueaccounting.EconomicAgent', null=True)), - ('receiver', models.ForeignKey(related_name='purchase_orders', verbose_name='receiver', blank=True, to='valueaccounting.EconomicAgent', null=True)), + ('changed_by', models.ForeignKey(related_name='orders_changed', verbose_name='changed by', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='orders_created', verbose_name='created by', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL)), + ('provider', models.ForeignKey(related_name='sales_orders', verbose_name='provider', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), + ('receiver', models.ForeignKey(related_name='purchase_orders', verbose_name='receiver', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), ], options={ 'ordering': ('due_date',), @@ -533,8 +533,8 @@ class Migration(migrations.Migration): name='PatternFacetValue', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('event_type', models.ForeignKey(related_name='patterns', verbose_name='event type', to='valueaccounting.EventType', help_text='consumed means gone, used means re-usable')), - ('facet_value', models.ForeignKey(related_name='patterns', verbose_name='facet value', to='valueaccounting.FacetValue')), + ('event_type', models.ForeignKey(related_name='patterns', verbose_name='event type', to='valueaccounting.EventType', help_text='consumed means gone, used means re-usable', on_delete=models.CASCADE)), + ('facet_value', models.ForeignKey(related_name='patterns', verbose_name='facet value', to='valueaccounting.FacetValue', on_delete=models.CASCADE)), ], options={ 'ordering': ('pattern', 'event_type', 'facet_value'), @@ -564,10 +564,10 @@ class Migration(migrations.Migration): ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), ('slug', models.SlugField(verbose_name='Page name', editable=False)), - ('changed_by', models.ForeignKey(related_name='processes_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('context_agent', models.ForeignKey(related_name='processes', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True)), - ('created_by', models.ForeignKey(related_name='processes_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('parent', models.ForeignKey(related_name='sub_processes', blank=True, editable=False, to='valueaccounting.Process', null=True, verbose_name='parent')), + ('changed_by', models.ForeignKey(related_name='processes_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('context_agent', models.ForeignKey(related_name='processes', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='processes_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('parent', models.ForeignKey(related_name='sub_processes', blank=True, editable=False, to='valueaccounting.Process', null=True, verbose_name='parent', on_delete=models.SET_NULL)), ], options={ 'ordering': ('-end_date',), @@ -597,11 +597,11 @@ class Migration(migrations.Migration): ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), ('slug', models.SlugField(verbose_name='Page name', editable=False)), - ('changed_by', models.ForeignKey(related_name='process_types_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('context_agent', models.ForeignKey(related_name='process_types', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True)), - ('created_by', models.ForeignKey(related_name='process_types_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('parent', models.ForeignKey(related_name='sub_process_types', blank=True, editable=False, to='valueaccounting.ProcessType', null=True, verbose_name='parent')), - ('process_pattern', models.ForeignKey(related_name='process_types', verbose_name='process pattern', blank=True, to='valueaccounting.ProcessPattern', null=True)), + ('changed_by', models.ForeignKey(related_name='process_types_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('context_agent', models.ForeignKey(related_name='process_types', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='process_types_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('parent', models.ForeignKey(related_name='sub_process_types', blank=True, editable=False, to='valueaccounting.ProcessType', null=True, verbose_name='parent', on_delete=models.SET_NULL)), + ('process_pattern', models.ForeignKey(related_name='process_types', verbose_name='process pattern', blank=True, to='valueaccounting.ProcessPattern', null=True, on_delete=models.SET_NULL)), ], options={ 'ordering': ('name',), @@ -616,12 +616,12 @@ class Migration(migrations.Migration): ('description', models.TextField(null=True, verbose_name='description', blank=True)), ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), - ('changed_by', models.ForeignKey(related_name='ptrts_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('created_by', models.ForeignKey(related_name='ptrts_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('event_type', models.ForeignKey(related_name='process_resource_types', verbose_name='event type', to='valueaccounting.EventType')), - ('process_type', models.ForeignKey(related_name='resource_types', verbose_name='process type', to='valueaccounting.ProcessType')), - ('resource_type', models.ForeignKey(related_name='process_types', verbose_name='resource type', to='valueaccounting.EconomicResourceType')), - ('stage', models.ForeignKey(related_name='commitmenttypes_at_stage', verbose_name='stage', blank=True, to='valueaccounting.ProcessType', null=True)), + ('changed_by', models.ForeignKey(related_name='ptrts_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='ptrts_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('event_type', models.ForeignKey(related_name='process_resource_types', verbose_name='event type', to='valueaccounting.EventType', on_delete=models.CASCADE)), + ('process_type', models.ForeignKey(related_name='resource_types', verbose_name='process type', to='valueaccounting.ProcessType', on_delete=models.CASCADE)), + ('resource_type', models.ForeignKey(related_name='process_types', verbose_name='resource type', to='valueaccounting.EconomicResourceType', on_delete=models.CASCADE)), + ('stage', models.ForeignKey(related_name='commitmenttypes_at_stage', verbose_name='stage', blank=True, to='valueaccounting.ProcessType', null=True, on_delete=models.SET_NULL)), ], options={ 'ordering': ('resource_type',), @@ -634,8 +634,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('reciprocity_date', models.DateField(default=datetime.date.today, verbose_name='reciprocity date')), - ('initiating_commitment', models.ForeignKey(related_name='initiated_commitments', verbose_name='initiating commitment', to='valueaccounting.Commitment')), - ('reciprocal_commitment', models.ForeignKey(related_name='reciprocal_commitments', verbose_name='reciprocal commitment', to='valueaccounting.Commitment')), + ('initiating_commitment', models.ForeignKey(related_name='initiated_commitments', verbose_name='initiating commitment', to='valueaccounting.Commitment', on_delete=models.CASCADE)), + ('reciprocal_commitment', models.ForeignKey(related_name='reciprocal_commitments', verbose_name='reciprocal commitment', to='valueaccounting.Commitment', on_delete=models.CASCADE)), ], options={ 'ordering': ('reciprocity_date',), @@ -668,8 +668,8 @@ class Migration(migrations.Migration): name='ResourceTypeFacetValue', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('facet_value', models.ForeignKey(related_name='resource_types', verbose_name='facet value', to='valueaccounting.FacetValue')), - ('resource_type', models.ForeignKey(related_name='facets', verbose_name='resource type', to='valueaccounting.EconomicResourceType')), + ('facet_value', models.ForeignKey(related_name='resource_types', verbose_name='facet value', to='valueaccounting.FacetValue', on_delete=models.CASCADE)), + ('resource_type', models.ForeignKey(related_name='facets', verbose_name='resource type', to='valueaccounting.EconomicResourceType', on_delete=models.CASCADE)), ], options={ 'ordering': ('resource_type', 'facet_value'), @@ -682,7 +682,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=128, verbose_name='name')), ('description', models.TextField(null=True, verbose_name='description', blank=True)), - ('context_agent', models.ForeignKey(related_name='lists', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True)), + ('context_agent', models.ForeignKey(related_name='lists', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), ], options={ 'ordering': ('name',), @@ -694,8 +694,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('default_quantity', models.DecimalField(default=Decimal('1.0'), verbose_name='default quantity', max_digits=8, decimal_places=2)), - ('resource_type', models.ForeignKey(related_name='lists', verbose_name='resource type', to='valueaccounting.EconomicResourceType')), - ('resource_type_list', models.ForeignKey(related_name='list_elements', verbose_name='resource type list', to='valueaccounting.ResourceTypeList')), + ('resource_type', models.ForeignKey(related_name='lists', verbose_name='resource type', to='valueaccounting.EconomicResourceType', on_delete=models.CASCADE)), + ('resource_type_list', models.ForeignKey(related_name='list_elements', verbose_name='resource type list', to='valueaccounting.ResourceTypeList', on_delete=models.SET_NULL)), ], options={ 'ordering': ('resource_type_list', 'resource_type'), @@ -709,8 +709,8 @@ class Migration(migrations.Migration): ('identifier', models.CharField(max_length=128, verbose_name='identifier')), ('description', models.TextField(null=True, verbose_name='description', blank=True)), ('price_per_unit', models.DecimalField(default=Decimal('0.00'), verbose_name='price per unit', max_digits=8, decimal_places=2)), - ('resource_type', models.ForeignKey(related_name='prices', verbose_name='resource type', to='valueaccounting.EconomicResourceType')), - ('stage', models.ForeignKey(related_name='price_at_stage', verbose_name='stage', blank=True, to='valueaccounting.ProcessType', null=True)), + ('resource_type', models.ForeignKey(related_name='prices', verbose_name='resource type', to='valueaccounting.EconomicResourceType', on_delete=models.CASCADE)), + ('stage', models.ForeignKey(related_name='price_at_stage', verbose_name='stage', blank=True, to='valueaccounting.ProcessType', null=True, on_delete=models.SET_NULL)), ], options={ }, @@ -720,8 +720,8 @@ class Migration(migrations.Migration): name='SelectedOption', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('commitment', models.ForeignKey(related_name='options', verbose_name='commitment', to='valueaccounting.Commitment')), - ('option', models.ForeignKey(related_name='commitments', verbose_name='option', to='valueaccounting.Option')), + ('commitment', models.ForeignKey(related_name='options', verbose_name='commitment', to='valueaccounting.Commitment', on_delete=models.CASCADE)), + ('option', models.ForeignKey(related_name='commitments', verbose_name='option', to='valueaccounting.Option', on_delete=models.CASCADE)), ], options={ 'ordering': ('commitment', 'option'), @@ -738,10 +738,10 @@ class Migration(migrations.Migration): ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), ('slug', models.SlugField(verbose_name='Page name', editable=False)), - ('changed_by', models.ForeignKey(related_name='transfers_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('context_agent', models.ForeignKey(related_name='transfers', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True)), - ('created_by', models.ForeignKey(related_name='transfers_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('exchange', models.ForeignKey(related_name='transfers', verbose_name='exchange', blank=True, to='valueaccounting.Exchange', null=True)), + ('changed_by', models.ForeignKey(related_name='transfers_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('context_agent', models.ForeignKey(related_name='transfers', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='transfers_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('exchange', models.ForeignKey(related_name='transfers', verbose_name='exchange', blank=True, to='valueaccounting.Exchange', null=True, on_delete=models.SET_NULL)), ], options={ 'ordering': ('transfer_date',), @@ -765,11 +765,11 @@ class Migration(migrations.Migration): ('receive_agent_is_context', models.BooleanField(default=False, verbose_name='receive agent is context')), ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), - ('changed_by', models.ForeignKey(related_name='transfer_types_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('created_by', models.ForeignKey(related_name='transfer_types_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('exchange_type', models.ForeignKey(related_name='transfer_types', verbose_name='exchange type', to='valueaccounting.ExchangeType')), - ('give_agent_association_type', models.ForeignKey(related_name='transfer_types_give', verbose_name='give agent association type', blank=True, to='valueaccounting.AgentAssociationType', null=True)), - ('receive_agent_association_type', models.ForeignKey(related_name='transfer_types_receive', verbose_name='receive agent association type', blank=True, to='valueaccounting.AgentAssociationType', null=True)), + ('changed_by', models.ForeignKey(related_name='transfer_types_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='transfer_types_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('exchange_type', models.ForeignKey(related_name='transfer_types', verbose_name='exchange type', to='valueaccounting.ExchangeType', on_delete=models.CASCADE)), + ('give_agent_association_type', models.ForeignKey(related_name='transfer_types_give', verbose_name='give agent association type', blank=True, to='valueaccounting.AgentAssociationType', null=True, on_delete=models.SET_NULL)), + ('receive_agent_association_type', models.ForeignKey(related_name='transfer_types_receive', verbose_name='receive agent association type', blank=True, to='valueaccounting.AgentAssociationType', null=True, on_delete=models.SET_NULL)), ], options={ 'ordering': ('sequence',), @@ -780,8 +780,8 @@ class Migration(migrations.Migration): name='TransferTypeFacetValue', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('facet_value', models.ForeignKey(related_name='transfer_types', verbose_name='facet value', to='valueaccounting.FacetValue')), - ('transfer_type', models.ForeignKey(related_name='facet_values', verbose_name='transfer type', to='valueaccounting.TransferType')), + ('facet_value', models.ForeignKey(related_name='transfer_types', verbose_name='facet value', to='valueaccounting.FacetValue', on_delete=models.CASCADE)), + ('transfer_type', models.ForeignKey(related_name='facet_values', verbose_name='transfer type', to='valueaccounting.TransferType', on_delete=models.CASCADE)), ], options={ 'ordering': ('transfer_type', 'facet_value'), @@ -818,8 +818,8 @@ class Migration(migrations.Migration): name='UseCaseEventType', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('event_type', models.ForeignKey(related_name='use_cases', verbose_name='event type', to='valueaccounting.EventType')), - ('use_case', models.ForeignKey(related_name='event_types', verbose_name='use case', to='valueaccounting.UseCase')), + ('event_type', models.ForeignKey(related_name='use_cases', verbose_name='event type', to='valueaccounting.EventType', on_delete=models.CASCADE)), + ('use_case', models.ForeignKey(related_name='event_types', verbose_name='use case', to='valueaccounting.UseCase', on_delete=models.CASCADE)), ], options={ }, @@ -834,8 +834,8 @@ class Migration(migrations.Migration): ('percentage_behavior', models.CharField(default=b'straight', help_text='Remaining percentage uses the % of the remaining amount to be distributed. Straight percentage uses the % of the total distribution amount.', max_length=12, verbose_name='percentage behavior', choices=[(b'remaining', 'Remaining percentage'), (b'straight', 'Straight percentage')])), ('live', models.BooleanField(default=False, help_text='Make this value equation available for use in real distributions.', verbose_name='live')), ('created_date', models.DateField(auto_now_add=True, null=True)), - ('context_agent', models.ForeignKey(related_name='value_equations', verbose_name='context agent', to='valueaccounting.EconomicAgent')), - ('created_by', models.ForeignKey(related_name='value_equations_created', verbose_name='created by', blank=True, to=settings.AUTH_USER_MODEL, null=True)), + ('context_agent', models.ForeignKey(related_name='value_equations', verbose_name='context agent', to='valueaccounting.EconomicAgent', on_delete=models.CASCADE)), + ('created_by', models.ForeignKey(related_name='value_equations_created', verbose_name='created by', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL)), ], options={ }, @@ -851,11 +851,11 @@ class Migration(migrations.Migration): ('percentage', models.DecimalField(default=Decimal('0.0'), verbose_name='bucket percentage', max_digits=8, decimal_places=2)), ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), - ('changed_by', models.ForeignKey(related_name='buckets_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('created_by', models.ForeignKey(related_name='buckets_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('distribution_agent', models.ForeignKey(related_name='value_equation_buckets', verbose_name='distribution agent', blank=True, to='valueaccounting.EconomicAgent', null=True)), - ('filter_agent', models.ForeignKey(related_name='value_equation_filter_buckets', verbose_name='filter agent', blank=True, to='valueaccounting.EconomicAgent', null=True)), - ('value_equation', models.ForeignKey(related_name='buckets', verbose_name='value equation', to='valueaccounting.ValueEquation')), + ('changed_by', models.ForeignKey(related_name='buckets_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='buckets_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('distribution_agent', models.ForeignKey(related_name='value_equation_buckets', verbose_name='distribution agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), + ('filter_agent', models.ForeignKey(related_name='value_equation_filter_buckets', verbose_name='filter agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL)), + ('value_equation', models.ForeignKey(related_name='buckets', verbose_name='value equation', to='valueaccounting.ValueEquation', on_delete=models.CASCADE)), ], options={ 'ordering': ('sequence',), @@ -872,10 +872,10 @@ class Migration(migrations.Migration): ('claim_creation_equation', models.TextField(null=True, verbose_name='claim creation equation', blank=True)), ('created_date', models.DateField(auto_now_add=True, null=True)), ('changed_date', models.DateField(auto_now=True, null=True)), - ('changed_by', models.ForeignKey(related_name='rules_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by')), - ('created_by', models.ForeignKey(related_name='rules_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by')), - ('event_type', models.ForeignKey(related_name='bucket_rules', verbose_name='event type', to='valueaccounting.EventType')), - ('value_equation_bucket', models.ForeignKey(related_name='bucket_rules', verbose_name='value equation bucket', to='valueaccounting.ValueEquationBucket')), + ('changed_by', models.ForeignKey(related_name='rules_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL)), + ('created_by', models.ForeignKey(related_name='rules_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL)), + ('event_type', models.ForeignKey(related_name='bucket_rules', verbose_name='event type', to='valueaccounting.EventType', on_delete=models.CASCADE)), + ('value_equation_bucket', models.ForeignKey(related_name='bucket_rules', verbose_name='value equation bucket', to='valueaccounting.ValueEquationBucket', on_delete=models.CASCADE)), ], options={ }, @@ -888,7 +888,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='transfer', name='transfer_type', - field=models.ForeignKey(related_name='transfers', verbose_name='transfer type', blank=True, to='valueaccounting.TransferType', null=True), + field=models.ForeignKey(related_name='transfers', verbose_name='transfer type', blank=True, to='valueaccounting.TransferType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AlterUniqueTogether( @@ -902,19 +902,19 @@ class Migration(migrations.Migration): migrations.AddField( model_name='processtyperesourcetype', name='state', - field=models.ForeignKey(related_name='commitmenttypes_at_state', verbose_name='state', blank=True, to='valueaccounting.ResourceState', null=True), + field=models.ForeignKey(related_name='commitmenttypes_at_state', verbose_name='state', blank=True, to='valueaccounting.ResourceState', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='processtyperesourcetype', name='unit_of_quantity', - field=models.ForeignKey(related_name='process_resource_qty_units', verbose_name='unit', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='process_resource_qty_units', verbose_name='unit', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='process', name='process_pattern', - field=models.ForeignKey(related_name='processes', verbose_name='process pattern', blank=True, to='valueaccounting.ProcessPattern', null=True), + field=models.ForeignKey(related_name='processes', verbose_name='process pattern', blank=True, to='valueaccounting.ProcessPattern', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( @@ -926,19 +926,19 @@ class Migration(migrations.Migration): migrations.AddField( model_name='patternusecase', name='pattern', - field=models.ForeignKey(related_name='use_cases', verbose_name='pattern', to='valueaccounting.ProcessPattern'), + field=models.ForeignKey(related_name='use_cases', verbose_name='pattern', to='valueaccounting.ProcessPattern', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='patternusecase', name='use_case', - field=models.ForeignKey(related_name='patterns', verbose_name='use case', blank=True, to='valueaccounting.UseCase', null=True), + field=models.ForeignKey(related_name='patterns', verbose_name='use case', blank=True, to='valueaccounting.UseCase', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='patternfacetvalue', name='pattern', - field=models.ForeignKey(related_name='facets', verbose_name='pattern', to='valueaccounting.ProcessPattern'), + field=models.ForeignKey(related_name='facets', verbose_name='pattern', to='valueaccounting.ProcessPattern', on_delete=models.CASCADE), preserve_default=True, ), migrations.AlterUniqueTogether( @@ -948,25 +948,25 @@ class Migration(migrations.Migration): migrations.AddField( model_name='incomeeventdistribution', name='unit_of_quantity', - field=models.ForeignKey(related_name='units', verbose_name='unit', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='units', verbose_name='unit', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='feature', name='process_type', - field=models.ForeignKey(related_name='features', verbose_name='process type', blank=True, to='valueaccounting.ProcessType', null=True), + field=models.ForeignKey(related_name='features', verbose_name='process type', blank=True, to='valueaccounting.ProcessType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='feature', name='product', - field=models.ForeignKey(related_name='features', verbose_name='product', to='valueaccounting.EconomicResourceType'), + field=models.ForeignKey(related_name='features', verbose_name='product', to='valueaccounting.EconomicResourceType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='feature', name='unit_of_quantity', - field=models.ForeignKey(related_name='feature_units', verbose_name='unit', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='feature_units', verbose_name='unit', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AlterUniqueTogether( @@ -976,115 +976,115 @@ class Migration(migrations.Migration): migrations.AddField( model_name='exchangetype', name='use_case', - field=models.ForeignKey(related_name='exchange_types', verbose_name='use case', blank=True, to='valueaccounting.UseCase', null=True), + field=models.ForeignKey(related_name='exchange_types', verbose_name='use case', blank=True, to='valueaccounting.UseCase', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='exchange', name='exchange_type', - field=models.ForeignKey(related_name='exchanges', verbose_name='exchange type', blank=True, to='valueaccounting.ExchangeType', null=True), + field=models.ForeignKey(related_name='exchanges', verbose_name='exchange type', blank=True, to='valueaccounting.ExchangeType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='exchange', name='order', - field=models.ForeignKey(related_name='exchanges', verbose_name='order', blank=True, to='valueaccounting.Order', null=True), + field=models.ForeignKey(related_name='exchanges', verbose_name='order', blank=True, to='valueaccounting.Order', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='exchange', name='process_pattern', - field=models.ForeignKey(related_name='exchanges', verbose_name='pattern', blank=True, to='valueaccounting.ProcessPattern', null=True), + field=models.ForeignKey(related_name='exchanges', verbose_name='pattern', blank=True, to='valueaccounting.ProcessPattern', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='exchange', name='supplier', - field=models.ForeignKey(related_name='exchanges_as_supplier', verbose_name='supplier', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='exchanges_as_supplier', verbose_name='supplier', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='exchange', name='use_case', - field=models.ForeignKey(related_name='exchanges', verbose_name='use case', blank=True, to='valueaccounting.UseCase', null=True), + field=models.ForeignKey(related_name='exchanges', verbose_name='use case', blank=True, to='valueaccounting.UseCase', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresourcetype', name='resource_class', - field=models.ForeignKey(related_name='resource_types', verbose_name='resource class', blank=True, to='valueaccounting.ResourceClass', null=True), + field=models.ForeignKey(related_name='resource_types', verbose_name='resource class', blank=True, to='valueaccounting.ResourceClass', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresourcetype', name='unit', - field=models.ForeignKey(related_name='resource_units', blank=True, to='valueaccounting.Unit', help_text='if this resource has different units of use and inventory, this is the unit of inventory', null=True, verbose_name='unit'), + field=models.ForeignKey(related_name='resource_units', blank=True, to='valueaccounting.Unit', help_text='if this resource has different units of use and inventory, this is the unit of inventory', null=True, verbose_name='unit', on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresourcetype', name='unit_of_price', - field=models.ForeignKey(related_name='resource_type_price_units', verbose_name='unit of price', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='resource_type_price_units', verbose_name='unit of price', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresourcetype', name='unit_of_use', - field=models.ForeignKey(related_name='units_of_use', blank=True, to='valueaccounting.Unit', help_text='if this resource has different units of use and inventory, this is the unit of use', null=True, verbose_name='unit of use'), + field=models.ForeignKey(related_name='units_of_use', blank=True, to='valueaccounting.Unit', help_text='if this resource has different units of use and inventory, this is the unit of use', null=True, verbose_name='unit of use', on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresourcetype', name='unit_of_value', - field=models.ForeignKey(related_name='resource_type_value_units', blank=True, editable=False, to='valueaccounting.Unit', null=True, verbose_name='unit of value'), + field=models.ForeignKey(related_name='resource_type_value_units', blank=True, editable=False, to='valueaccounting.Unit', null=True, verbose_name='unit of value', on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresource', name='current_location', - field=models.ForeignKey(related_name='resources_at_location', verbose_name='current location', blank=True, to='valueaccounting.Location', null=True), + field=models.ForeignKey(related_name='resources_at_location', verbose_name='current location', blank=True, to='valueaccounting.Location', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresource', name='exchange_stage', - field=models.ForeignKey(related_name='resources_at_exchange_stage', verbose_name='exchange stage', blank=True, to='valueaccounting.ExchangeType', null=True), + field=models.ForeignKey(related_name='resources_at_exchange_stage', verbose_name='exchange stage', blank=True, to='valueaccounting.ExchangeType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresource', name='independent_demand', - field=models.ForeignKey(related_name='dependent_resources', verbose_name='independent demand', blank=True, to='valueaccounting.Order', null=True), + field=models.ForeignKey(related_name='dependent_resources', verbose_name='independent demand', blank=True, to='valueaccounting.Order', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresource', name='order_item', - field=models.ForeignKey(related_name='stream_resources', verbose_name='order item', blank=True, to='valueaccounting.Commitment', null=True), + field=models.ForeignKey(related_name='stream_resources', verbose_name='order item', blank=True, to='valueaccounting.Commitment', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresource', name='resource_type', - field=models.ForeignKey(related_name='resources', verbose_name='resource type', to='valueaccounting.EconomicResourceType'), + field=models.ForeignKey(related_name='resources', verbose_name='resource type', to='valueaccounting.EconomicResourceType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='economicresource', name='stage', - field=models.ForeignKey(related_name='resources_at_stage', verbose_name='stage', blank=True, to='valueaccounting.ProcessType', null=True), + field=models.ForeignKey(related_name='resources_at_stage', verbose_name='stage', blank=True, to='valueaccounting.ProcessType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicresource', name='state', - field=models.ForeignKey(related_name='resources_at_state', verbose_name='state', blank=True, to='valueaccounting.ResourceState', null=True), + field=models.ForeignKey(related_name='resources_at_state', verbose_name='state', blank=True, to='valueaccounting.ResourceState', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicevent', name='event_type', - field=models.ForeignKey(related_name='events', verbose_name='event type', to='valueaccounting.EventType'), + field=models.ForeignKey(related_name='events', verbose_name='event type', to='valueaccounting.EventType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( @@ -1096,13 +1096,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='economicevent', name='exchange_stage', - field=models.ForeignKey(related_name='events_creating_exchange_stage', verbose_name='exchange stage', blank=True, to='valueaccounting.ExchangeType', null=True), + field=models.ForeignKey(related_name='events_creating_exchange_stage', verbose_name='exchange stage', blank=True, to='valueaccounting.ExchangeType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicevent', name='from_agent', - field=models.ForeignKey(related_name='given_events', verbose_name='from', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='given_events', verbose_name='from', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( @@ -1114,19 +1114,19 @@ class Migration(migrations.Migration): migrations.AddField( model_name='economicevent', name='resource', - field=models.ForeignKey(related_name='events', verbose_name='resource', blank=True, to='valueaccounting.EconomicResource', null=True), + field=models.ForeignKey(related_name='events', verbose_name='resource', blank=True, to='valueaccounting.EconomicResource', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicevent', name='resource_type', - field=models.ForeignKey(related_name='events', verbose_name='resource type', to='valueaccounting.EconomicResourceType'), + field=models.ForeignKey(related_name='events', verbose_name='resource type', to='valueaccounting.EconomicResourceType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='economicevent', name='to_agent', - field=models.ForeignKey(related_name='taken_events', verbose_name='to', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='taken_events', verbose_name='to', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( @@ -1138,19 +1138,19 @@ class Migration(migrations.Migration): migrations.AddField( model_name='economicevent', name='unit_of_price', - field=models.ForeignKey(related_name='event_price_units', verbose_name='unit of price', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='event_price_units', verbose_name='unit of price', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicevent', name='unit_of_quantity', - field=models.ForeignKey(related_name='event_qty_units', verbose_name='unit', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='event_qty_units', verbose_name='unit', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='economicevent', name='unit_of_value', - field=models.ForeignKey(related_name='event_value_units', verbose_name='unit of value', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='event_value_units', verbose_name='unit of value', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( @@ -1162,175 +1162,175 @@ class Migration(migrations.Migration): migrations.AddField( model_name='economicagent', name='unit_of_claim_value', - field=models.ForeignKey(related_name='agents', blank=True, to='valueaccounting.Unit', help_text='For a context agent, the unit of all claims', null=True, verbose_name='unit used in claims'), + field=models.ForeignKey(related_name='agents', blank=True, to='valueaccounting.Unit', help_text='For a context agent, the unit of all claims', null=True, verbose_name='unit used in claims', on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='distributionvalueequation', name='exchange', - field=models.ForeignKey(related_name='value_equation', verbose_name='exchange', blank=True, to='valueaccounting.Exchange', null=True), + field=models.ForeignKey(related_name='value_equation', verbose_name='exchange', blank=True, to='valueaccounting.Exchange', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='distributionvalueequation', name='value_equation_link', - field=models.ForeignKey(related_name='distributions_ve', verbose_name='value equation link', blank=True, to='valueaccounting.ValueEquation', null=True), + field=models.ForeignKey(related_name='distributions_ve', verbose_name='value equation link', blank=True, to='valueaccounting.ValueEquation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='distribution', name='context_agent', - field=models.ForeignKey(related_name='distributions', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='distributions', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='distribution', name='created_by', - field=models.ForeignKey(related_name='distributions_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by'), + field=models.ForeignKey(related_name='distributions_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='distribution', name='process_pattern', - field=models.ForeignKey(related_name='distributions', verbose_name='pattern', blank=True, to='valueaccounting.ProcessPattern', null=True), + field=models.ForeignKey(related_name='distributions', verbose_name='pattern', blank=True, to='valueaccounting.ProcessPattern', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='distribution', name='value_equation', - field=models.ForeignKey(related_name='distributions', verbose_name='value equation link', blank=True, to='valueaccounting.ValueEquation', null=True), + field=models.ForeignKey(related_name='distributions', verbose_name='value equation link', blank=True, to='valueaccounting.ValueEquation', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='context_agent', - field=models.ForeignKey(related_name='commitments', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='commitments', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='created_by', - field=models.ForeignKey(related_name='commitments_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by'), + field=models.ForeignKey(related_name='commitments_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='event_type', - field=models.ForeignKey(related_name='commitments', verbose_name='event type', to='valueaccounting.EventType'), + field=models.ForeignKey(related_name='commitments', verbose_name='event type', to='valueaccounting.EventType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='commitment', name='exchange', - field=models.ForeignKey(related_name='commitments', verbose_name='exchange', blank=True, to='valueaccounting.Exchange', null=True), + field=models.ForeignKey(related_name='commitments', verbose_name='exchange', blank=True, to='valueaccounting.Exchange', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='exchange_stage', - field=models.ForeignKey(related_name='commitments_at_exchange_stage', verbose_name='exchange stage', blank=True, to='valueaccounting.ExchangeType', null=True), + field=models.ForeignKey(related_name='commitments_at_exchange_stage', verbose_name='exchange stage', blank=True, to='valueaccounting.ExchangeType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='from_agent', - field=models.ForeignKey(related_name='given_commitments', verbose_name='from', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='given_commitments', verbose_name='from', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='from_agent_type', - field=models.ForeignKey(related_name='given_commitments', verbose_name='from agent type', blank=True, to='valueaccounting.AgentType', null=True), + field=models.ForeignKey(related_name='given_commitments', verbose_name='from agent type', blank=True, to='valueaccounting.AgentType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='independent_demand', - field=models.ForeignKey(related_name='dependent_commitments', verbose_name='independent demand', blank=True, to='valueaccounting.Order', null=True), + field=models.ForeignKey(related_name='dependent_commitments', verbose_name='independent demand', blank=True, to='valueaccounting.Order', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='order', - field=models.ForeignKey(related_name='commitments', verbose_name='order', blank=True, to='valueaccounting.Order', null=True), + field=models.ForeignKey(related_name='commitments', verbose_name='order', blank=True, to='valueaccounting.Order', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='order_item', - field=models.ForeignKey(related_name='stream_commitments', verbose_name='order item', blank=True, to='valueaccounting.Commitment', null=True), + field=models.ForeignKey(related_name='stream_commitments', verbose_name='order item', blank=True, to='valueaccounting.Commitment', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='process', - field=models.ForeignKey(related_name='commitments', verbose_name='process', blank=True, to='valueaccounting.Process', null=True), + field=models.ForeignKey(related_name='commitments', verbose_name='process', blank=True, to='valueaccounting.Process', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='resource', - field=models.ForeignKey(related_name='commitments', verbose_name='resource', blank=True, to='valueaccounting.EconomicResource', null=True), + field=models.ForeignKey(related_name='commitments', verbose_name='resource', blank=True, to='valueaccounting.EconomicResource', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='resource_type', - field=models.ForeignKey(related_name='commitments', verbose_name='resource type', blank=True, to='valueaccounting.EconomicResourceType', null=True), + field=models.ForeignKey(related_name='commitments', verbose_name='resource type', blank=True, to='valueaccounting.EconomicResourceType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='stage', - field=models.ForeignKey(related_name='commitments_at_stage', verbose_name='stage', blank=True, to='valueaccounting.ProcessType', null=True), + field=models.ForeignKey(related_name='commitments_at_stage', verbose_name='stage', blank=True, to='valueaccounting.ProcessType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='state', - field=models.ForeignKey(related_name='commitments_at_state', verbose_name='state', blank=True, to='valueaccounting.ResourceState', null=True), + field=models.ForeignKey(related_name='commitments_at_state', verbose_name='state', blank=True, to='valueaccounting.ResourceState', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='to_agent', - field=models.ForeignKey(related_name='taken_commitments', verbose_name='to', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='taken_commitments', verbose_name='to', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='transfer', - field=models.ForeignKey(related_name='commitments', blank=True, to='valueaccounting.Transfer', null=True), + field=models.ForeignKey(related_name='commitments', blank=True, to='valueaccounting.Transfer', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='unit_of_quantity', - field=models.ForeignKey(related_name='commitment_qty_units', verbose_name='unit', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='commitment_qty_units', verbose_name='unit', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='commitment', name='unit_of_value', - field=models.ForeignKey(related_name='commitment_value_units', verbose_name='unit of value', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='commitment_value_units', verbose_name='unit of value', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='claimevent', name='event', - field=models.ForeignKey(related_name='claim_events', verbose_name='claim event', blank=True, to='valueaccounting.EconomicEvent', null=True), + field=models.ForeignKey(related_name='claim_events', verbose_name='claim event', blank=True, to='valueaccounting.EconomicEvent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='claimevent', name='unit_of_value', - field=models.ForeignKey(related_name='claim_event_value_units', verbose_name='unit of value', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='claim_event_value_units', verbose_name='unit of value', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='claim', name='against_agent', - field=models.ForeignKey(related_name='claims_against', verbose_name='against', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='claims_against', verbose_name='against', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( @@ -1342,127 +1342,127 @@ class Migration(migrations.Migration): migrations.AddField( model_name='claim', name='has_agent', - field=models.ForeignKey(related_name='has_claims', verbose_name='has', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='has_claims', verbose_name='has', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='claim', name='unit_of_value', - field=models.ForeignKey(related_name='claim_value_units', verbose_name='unit of value', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='claim_value_units', verbose_name='unit of value', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='claim', name='value_equation_bucket_rule', - field=models.ForeignKey(related_name='claims', verbose_name='value equation bucket rule', blank=True, to='valueaccounting.ValueEquationBucketRule', null=True), + field=models.ForeignKey(related_name='claims', verbose_name='value equation bucket rule', blank=True, to='valueaccounting.ValueEquationBucketRule', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='cachedeventsummary', name='agent', - field=models.ForeignKey(related_name='cached_events', verbose_name='agent', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='cached_events', verbose_name='agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='cachedeventsummary', name='context_agent', - field=models.ForeignKey(related_name='context_cached_events', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='context_cached_events', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='cachedeventsummary', name='event_type', - field=models.ForeignKey(related_name='cached_events', verbose_name='event type', to='valueaccounting.EventType'), + field=models.ForeignKey(related_name='cached_events', verbose_name='event type', to='valueaccounting.EventType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='cachedeventsummary', name='resource_type', - field=models.ForeignKey(related_name='cached_events', verbose_name='resource type', blank=True, to='valueaccounting.EconomicResourceType', null=True), + field=models.ForeignKey(related_name='cached_events', verbose_name='resource type', blank=True, to='valueaccounting.EconomicResourceType', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='agentuser', name='agent', - field=models.ForeignKey(related_name='users', verbose_name='agent', to='valueaccounting.EconomicAgent'), + field=models.ForeignKey(related_name='users', verbose_name='agent', to='valueaccounting.EconomicAgent', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='agentuser', name='user', - field=models.OneToOneField(related_name='agent', verbose_name='user', to=settings.AUTH_USER_MODEL), + field=models.OneToOneField(related_name='agent', verbose_name='user', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='agentresourcetype', name='agent', - field=models.ForeignKey(related_name='resource_types', verbose_name='agent', to='valueaccounting.EconomicAgent'), + field=models.ForeignKey(related_name='resource_types', verbose_name='agent', to='valueaccounting.EconomicAgent', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='agentresourcetype', name='changed_by', - field=models.ForeignKey(related_name='arts_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by'), + field=models.ForeignKey(related_name='arts_changed', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='changed by', on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='agentresourcetype', name='created_by', - field=models.ForeignKey(related_name='arts_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by'), + field=models.ForeignKey(related_name='arts_created', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='created by', on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='agentresourcetype', name='event_type', - field=models.ForeignKey(related_name='agent_resource_types', verbose_name='event type', to='valueaccounting.EventType'), + field=models.ForeignKey(related_name='agent_resource_types', verbose_name='event type', to='valueaccounting.EventType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='agentresourcetype', name='resource_type', - field=models.ForeignKey(related_name='agents', verbose_name='resource type', to='valueaccounting.EconomicResourceType'), + field=models.ForeignKey(related_name='agents', verbose_name='resource type', to='valueaccounting.EconomicResourceType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='agentresourcetype', name='unit_of_value', - field=models.ForeignKey(related_name='agent_resource_value_units', verbose_name='unit of value', blank=True, to='valueaccounting.Unit', null=True), + field=models.ForeignKey(related_name='agent_resource_value_units', verbose_name='unit of value', blank=True, to='valueaccounting.Unit', null=True, on_delete=models.SET_NULL), preserve_default=True, ), migrations.AddField( model_name='agentresourcerole', name='agent', - field=models.ForeignKey(related_name='agent_resource_roles', verbose_name='agent', to='valueaccounting.EconomicAgent'), + field=models.ForeignKey(related_name='agent_resource_roles', verbose_name='agent', to='valueaccounting.EconomicAgent', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='agentresourcerole', name='resource', - field=models.ForeignKey(related_name='agent_resource_roles', verbose_name='resource', to='valueaccounting.EconomicResource'), + field=models.ForeignKey(related_name='agent_resource_roles', verbose_name='resource', to='valueaccounting.EconomicResource', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='agentresourcerole', name='role', - field=models.ForeignKey(related_name='agent_resource_roles', verbose_name='role', to='valueaccounting.AgentResourceRoleType'), + field=models.ForeignKey(related_name='agent_resource_roles', verbose_name='role', to='valueaccounting.AgentResourceRoleType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='agentassociation', name='association_type', - field=models.ForeignKey(related_name='associations', verbose_name='association type', to='valueaccounting.AgentAssociationType'), + field=models.ForeignKey(related_name='associations', verbose_name='association type', to='valueaccounting.AgentAssociationType', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='agentassociation', name='has_associate', - field=models.ForeignKey(related_name='has_associates', verbose_name='has associate', to='valueaccounting.EconomicAgent'), + field=models.ForeignKey(related_name='has_associates', verbose_name='has associate', to='valueaccounting.EconomicAgent', on_delete=models.CASCADE), preserve_default=True, ), migrations.AddField( model_name='agentassociation', name='is_associate', - field=models.ForeignKey(related_name='is_associate_of', verbose_name='is associate of', to='valueaccounting.EconomicAgent'), + field=models.ForeignKey(related_name='is_associate_of', verbose_name='is associate of', to='valueaccounting.EconomicAgent', on_delete=models.CASCADE), preserve_default=True, ), ] diff --git a/valuenetwork/valueaccounting/migrations/0002_auto_20160706_2026.py b/valuenetwork/valueaccounting/migrations/0002_auto_20160706_2026.py index 16cf95f99..6cadd7036 100644 --- a/valuenetwork/valueaccounting/migrations/0002_auto_20160706_2026.py +++ b/valuenetwork/valueaccounting/migrations/0002_auto_20160706_2026.py @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='agenttype', name='parent', - field=models.ForeignKey(related_name='sub_agents', blank=True, editable=False, to='valueaccounting.AgentType', null=True, verbose_name='parent'), + field=models.ForeignKey(related_name='sub_agents', blank=True, editable=False, to='valueaccounting.AgentType', null=True, verbose_name='parent', on_delete=models.SET_NULL), preserve_default=True, ), ] diff --git a/valuenetwork/valueaccounting/migrations/0005_auto_20161125_1138.py b/valuenetwork/valueaccounting/migrations/0005_auto_20161125_1138.py index 9d53381d7..73cbe73b8 100644 --- a/valuenetwork/valueaccounting/migrations/0005_auto_20161125_1138.py +++ b/valuenetwork/valueaccounting/migrations/0005_auto_20161125_1138.py @@ -14,16 +14,16 @@ class Migration(migrations.Migration): migrations.AddField( model_name='economicresourcetype', name='context_agent', - field=models.ForeignKey(related_name='context_resource_types', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='context_resource_types', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), ), migrations.AddField( model_name='exchangetype', name='context_agent', - field=models.ForeignKey(related_name='exchange_types', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='exchange_types', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), ), migrations.AddField( model_name='processpattern', name='context_agent', - field=models.ForeignKey(related_name='process_patterns', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True), + field=models.ForeignKey(related_name='process_patterns', verbose_name='context agent', blank=True, to='valueaccounting.EconomicAgent', null=True, on_delete=models.SET_NULL), ), ] diff --git a/valuenetwork/valueaccounting/models.py b/valuenetwork/valueaccounting/models.py index 8aa383440..574b2cd26 100644 --- a/valuenetwork/valueaccounting/models.py +++ b/valuenetwork/valueaccounting/models.py @@ -237,7 +237,7 @@ def value_list(self): class FacetValue(models.Model): facet = models.ForeignKey(Facet, - verbose_name=_('facet'), related_name='values') + verbose_name=_('facet'), related_name='values', on_delete=models.CASCADE) value = models.CharField(_('value'), max_length=32) description = models.TextField(_('description'), blank=True, null=True) @@ -350,7 +350,7 @@ def individual_type(self): class AgentType(models.Model): name = models.CharField(_('name'), max_length=128) - parent = models.ForeignKey('self', blank=True, null=True, + parent = models.ForeignKey('self', blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('parent'), related_name='sub_agents', editable=False) party_type = models.CharField(_('party type'), max_length=12, choices=SIZE_CHOICES, @@ -486,7 +486,7 @@ class EconomicAgent(models.Model): help_text=_("Must be unique, and no more than 32 characters")) url = models.CharField(_('url'), max_length=255, blank=True) agent_type = models.ForeignKey(AgentType, - verbose_name=_('agent type'), related_name='agents') + verbose_name=_('agent type'), related_name='agents', on_delete=models.CASCADE) description = models.TextField(_('description'), blank=True, null=True) address = models.CharField(_('address'), max_length=255, blank=True) email = models.EmailField(_('email address'), max_length=96, blank=True, null=True) @@ -505,14 +505,14 @@ class EconomicAgent(models.Model): photo_url = models.CharField(_('photo url'), max_length=255, blank=True) unit_of_claim_value = models.ForeignKey(Unit, blank=True, null=True, verbose_name=_('unit used in claims'), related_name="agents", - help_text=_('For a context agent, the unit of all claims')) + help_text=_('For a context agent, the unit of all claims'), on_delete=models.SET_NULL) is_context = models.BooleanField(_('is context'), default=False) slug = models.SlugField(_("Page name"), editable=False) created_date = models.DateField(_('created date'), default=datetime.date.today) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='agents_created', blank=True, null=True, editable=False) + related_name='agents_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='agents_changed', blank=True, null=True, editable=False) + related_name='agents_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) objects = AgentManager() @@ -2155,8 +2155,8 @@ def contexts_participated_in(self): class AgentUser(models.Model): agent = models.ForeignKey(EconomicAgent, - verbose_name=_('agent'), related_name='users') - user = models.OneToOneField(User, + verbose_name=_('agent'), related_name='users', on_delete=models.CASCADE) + user = models.OneToOneField(User, on_delete=models.CASCADE, verbose_name=_('user'), related_name='agent') @@ -2279,11 +2279,11 @@ def create_agent_association_types(**kwargs): class AgentAssociation(models.Model): is_associate = models.ForeignKey(EconomicAgent, - verbose_name=_('is associate of'), related_name='is_associate_of') + verbose_name=_('is associate of'), related_name='is_associate_of', on_delete=models.CASCADE) has_associate = models.ForeignKey(EconomicAgent, - verbose_name=_('has associate'), related_name='has_associates') + verbose_name=_('has associate'), related_name='has_associates', on_delete=models.CASCADE) association_type = models.ForeignKey(AgentAssociationType, - verbose_name=_('association type'), related_name='associations') + verbose_name=_('association type'), related_name='associations', on_delete=models.CASCADE) description = models.TextField(_('description'), blank=True, null=True) state = models.CharField(_('state'), max_length=12, choices=RELATIONSHIP_STATE_CHOICES, @@ -2775,16 +2775,16 @@ class EconomicResourceType(models.Model): name = models.CharField(_('name'), max_length=128, unique=True) #version = models.CharField(_('version'), max_length=32, blank=True) parent = models.ForeignKey('self', blank=True, null=True, - verbose_name=_('parent'), related_name='children') + verbose_name=_('parent'), related_name='children', on_delete=models.SET_NULL) resource_class = models.ForeignKey(ResourceClass, blank=True, null=True, - verbose_name=_('resource class'), related_name='resource_types') - unit = models.ForeignKey(Unit, blank=True, null=True, + verbose_name=_('resource class'), related_name='resource_types', on_delete=models.SET_NULL) + unit = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit'), related_name="resource_units", help_text=_('if this resource has different units of use and inventory, this is the unit of inventory')) - unit_of_use = models.ForeignKey(Unit, blank=True, null=True, + unit_of_use = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit of use'), related_name="units_of_use", help_text=_('if this resource has different units of use and inventory, this is the unit of use')) - unit_of_value = models.ForeignKey(Unit, blank=True, null=True, + unit_of_value = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={'unit_type': 'value'}, verbose_name=_('unit of value'), related_name="resource_type_value_units", editable=False) value_per_unit = models.DecimalField(_('value per unit'), max_digits=8, decimal_places=2, @@ -2793,7 +2793,7 @@ class EconomicResourceType(models.Model): default=Decimal("0.00"), editable=False) price_per_unit = models.DecimalField(_('price per unit'), max_digits=8, decimal_places=2, default=Decimal("0.00")) - unit_of_price = models.ForeignKey(Unit, blank=True, null=True, + unit_of_price = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={'unit_type': 'value'}, verbose_name=_('unit of price'), related_name="resource_type_price_units") substitutable = models.BooleanField(_('substitutable'), default=True, @@ -2807,19 +2807,19 @@ class EconomicResourceType(models.Model): photo_url = models.CharField(_('photo url'), max_length=255, blank=True) url = models.CharField(_('url'), max_length=255, blank=True) description = models.TextField(_('description'), blank=True, null=True) - accounting_reference = models.ForeignKey(AccountingReference, blank=True, null=True, + accounting_reference = models.ForeignKey(AccountingReference, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('accounting reference'), related_name="resource_types", help_text=_('optional reference to an external account')) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='resource_types_created', blank=True, null=True, editable=False) + related_name='resource_types_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='resource_types_changed', blank=True, null=True, editable=False) + related_name='resource_types_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) slug = models.SlugField(_("Page name"), editable=False) context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={"is_context": True,}, verbose_name=_('context agent'), related_name='context_resource_types') @@ -3690,7 +3690,7 @@ class ResourceTypeList(models.Model): name = models.CharField(_('name'), max_length=128) description = models.TextField(_('description'), blank=True, null=True) context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={"is_context": True,}, verbose_name=_('context agent'), related_name='lists') @@ -3723,9 +3723,9 @@ def recipe_class(self): class ResourceTypeListElement(models.Model): resource_type_list = models.ForeignKey(ResourceTypeList, - verbose_name=_('resource type list'), related_name='list_elements') + verbose_name=_('resource type list'), related_name='list_elements', on_delete=models.CASCADE) resource_type = models.ForeignKey(EconomicResourceType, - verbose_name=_('resource type'), related_name='lists') + verbose_name=_('resource type'), related_name='lists', on_delete=models.CASCADE) default_quantity = models.DecimalField(_('default quantity'), max_digits=8, decimal_places=2, default=Decimal("1.0")) @@ -3739,9 +3739,9 @@ def __unicode__(self): class ResourceTypeFacetValue(models.Model): resource_type = models.ForeignKey(EconomicResourceType, - verbose_name=_('resource type'), related_name='facets') + verbose_name=_('resource type'), related_name='facets', on_delete=models.CASCADE) facet_value = models.ForeignKey(FacetValue, - verbose_name=_('facet value'), related_name='resource_types') + verbose_name=_('facet value'), related_name='resource_types', on_delete=models.CASCADE) class Meta: unique_together = ('resource_type', 'facet_value') @@ -3795,7 +3795,7 @@ class ProcessPattern(models.Model): name = models.CharField(_('name'), max_length=32) context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={"is_context": True,}, verbose_name=_('context agent'), related_name='process_patterns') @@ -4098,11 +4098,11 @@ def facet_values_for_facet_and_relationship(self, facet, relationship): class PatternFacetValue(models.Model): - pattern = models.ForeignKey(ProcessPattern, + pattern = models.ForeignKey(ProcessPattern, on_delete=models.CASCADE, verbose_name=_('pattern'), related_name='facets') - facet_value = models.ForeignKey(FacetValue, + facet_value = models.ForeignKey(FacetValue, on_delete=models.CASCADE, verbose_name=_('facet value'), related_name='patterns') - event_type = models.ForeignKey(EventType, + event_type = models.ForeignKey(EventType, on_delete=models.CASCADE, verbose_name=_('event type'), related_name='patterns', help_text=_('consumed means gone, used means re-usable')) @@ -4259,9 +4259,9 @@ def create_event_types(**kwargs): #post_migrate.connect(create_event_types, sender=ValueAccountingAppConfig) class UseCaseEventType(models.Model): - use_case = models.ForeignKey(UseCase, + use_case = models.ForeignKey(UseCase, on_delete=models.CASCADE, verbose_name=_('use case'), related_name='event_types') - event_type = models.ForeignKey(EventType, + event_type = models.ForeignKey(EventType, on_delete=models.CASCADE, verbose_name=_('event type'), related_name='use_cases') def __unicode__(self): @@ -4356,9 +4356,9 @@ def create_usecase_eventtypes(**kwargs): class PatternUseCase(models.Model): pattern = models.ForeignKey(ProcessPattern, - verbose_name=_('pattern'), related_name='use_cases') + verbose_name=_('pattern'), related_name='use_cases', on_delete=models.CASCADE) use_case = models.ForeignKey(UseCase, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('use case'), related_name='patterns') def __unicode__(self): @@ -4408,18 +4408,18 @@ class Order(models.Model): name = models.CharField(_('name'), max_length=255, blank=True, help_text=_("appended to process labels for Work orders")) receiver = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="purchase_orders", verbose_name=_('receiver')) provider = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="sales_orders", verbose_name=_('provider')) order_date = models.DateField(_('order date'), default=datetime.date.today) due_date = models.DateField(_('due date')) description = models.TextField(_('description'), null=True, blank=True) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='orders_created', blank=True, null=True) + related_name='orders_created', blank=True, null=True, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='orders_changed', blank=True, null=True) + related_name='orders_changed', blank=True, null=True, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) @@ -5024,13 +5024,13 @@ def workflow_process_types(self): class ProcessType(models.Model): name = models.CharField(_('name'), max_length=128) - parent = models.ForeignKey('self', blank=True, null=True, + parent = models.ForeignKey('self', blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('parent'), related_name='sub_process_types', editable=False) process_pattern = models.ForeignKey(ProcessPattern, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('process pattern'), related_name='process_types') context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={"is_context": True,}, verbose_name=_('context agent'), related_name='process_types') description = models.TextField(_('description'), blank=True, null=True) @@ -5038,9 +5038,9 @@ class ProcessType(models.Model): estimated_duration = models.IntegerField(_('estimated duration'), default=0, help_text=_("in minutes, e.g. 3 hours = 180")) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='process_types_created', blank=True, null=True, editable=False) + related_name='process_types_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='process_types_changed', blank=True, null=True, editable=False) + related_name='process_types_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) slug = models.SlugField(_("Page name"), editable=False) @@ -5371,14 +5371,14 @@ def xbill_class(self): class ResourceTypeSpecialPrice(models.Model): - resource_type = models.ForeignKey(EconomicResourceType, + resource_type = models.ForeignKey(EconomicResourceType, on_delete=models.CASCADE, verbose_name=_('resource type'), related_name='prices') identifier = models.CharField(_('identifier'), max_length=128) description = models.TextField(_('description'), blank=True, null=True) price_per_unit = models.DecimalField(_('price per unit'), max_digits=8, decimal_places=2, default=Decimal("0.00")) stage = models.ForeignKey(ProcessType, related_name="price_at_stage", - verbose_name=_('stage'), blank=True, null=True) + verbose_name=_('stage'), blank=True, null=True, on_delete=models.SET_NULL) class ExchangeTypeManager(models.Manager): @@ -5412,19 +5412,19 @@ def membership_share_exchange_type(self): class ExchangeType(models.Model): name = models.CharField(_('name'), max_length=128) use_case = models.ForeignKey(UseCase, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('use case'), related_name='exchange_types') description = models.TextField(_('description'), blank=True, null=True) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='exchange_types_created', blank=True, null=True, editable=False) + related_name='exchange_types_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='exchange_types_changed', blank=True, null=True, editable=False) + related_name='exchange_types_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) slug = models.SlugField(_("Page name"), editable=False) context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={"is_context": True,}, verbose_name=_('context agent'), related_name='exchange_types') @@ -5532,24 +5532,24 @@ def all_economic_resources(self): class EconomicResource(models.Model): resource_type = models.ForeignKey(EconomicResourceType, - verbose_name=_('resource type'), related_name='resources') + verbose_name=_('resource type'), related_name='resources', on_delete=models.CASCADE) identifier = models.CharField(_('identifier'), blank=True, max_length=128) independent_demand = models.ForeignKey(Order, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="dependent_resources", verbose_name=_('independent demand')) order_item = models.ForeignKey("Commitment", - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="stream_resources", verbose_name=_('order item')) stage = models.ForeignKey(ProcessType, related_name="resources_at_stage", - verbose_name=_('stage'), blank=True, null=True) + verbose_name=_('stage'), blank=True, null=True, on_delete=models.SET_NULL) exchange_stage = models.ForeignKey(ExchangeType, related_name="resources_at_exchange_stage", - verbose_name=_('exchange stage'), blank=True, null=True) + verbose_name=_('exchange stage'), blank=True, null=True, on_delete=models.SET_NULL) state = models.ForeignKey(ResourceState, related_name="resources_at_state", - verbose_name=_('state'), blank=True, null=True) + verbose_name=_('state'), blank=True, null=True, on_delete=models.SET_NULL) url = models.CharField(_('url'), max_length=255, blank=True) #todo: remove author, in the meantime, don't use it author = models.ForeignKey(EconomicAgent, related_name="authored_resources", - verbose_name=_('author'), blank=True, null=True) + verbose_name=_('author'), blank=True, null=True, on_delete=models.SET_NULL) quantity = models.DecimalField(_('quantity'), max_digits=8, decimal_places=2, default=Decimal("0.00")) quality = models.DecimalField(_('quality'), max_digits=3, decimal_places=0, @@ -5561,7 +5561,7 @@ class EconomicResource(models.Model): access_rules = models.TextField(_('access rules'), blank=True, null=True) current_location = models.ForeignKey(Location, verbose_name=_('current location'), related_name='resources_at_location', - blank=True, null=True) + blank=True, null=True, on_delete=models.SET_NULL) value_per_unit = models.DecimalField(_('value per unit'), max_digits=8, decimal_places=2, default=Decimal("0.00")) value_per_unit_of_use = models.DecimalField(_('value per unit of use'), max_digits=8, decimal_places=2, @@ -5570,9 +5570,9 @@ class EconomicResource(models.Model): default=Decimal("0.00")) created_date = models.DateField(_('created date'), default=datetime.date.today) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='resources_created', blank=True, null=True, editable=False) + related_name='resources_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='resources_changed', blank=True, null=True, editable=False) + related_name='resources_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) objects = EconomicResourceManager() @@ -7125,29 +7125,29 @@ def revert_to_previous_stage(self): class AgentResourceType(models.Model): - agent = models.ForeignKey(EconomicAgent, + agent = models.ForeignKey(EconomicAgent, on_delete=models.CASCADE, verbose_name=_('agent'), related_name='resource_types') - resource_type = models.ForeignKey(EconomicResourceType, + resource_type = models.ForeignKey(EconomicResourceType, on_delete=models.CASCADE, verbose_name=_('resource type'), related_name='agents') score = models.DecimalField(_('score'), max_digits=8, decimal_places=2, default=Decimal("0.0"), help_text=_("the quantity of contributions of this resource type from this agent")) - event_type = models.ForeignKey(EventType, + event_type = models.ForeignKey(EventType, on_delete=models.CASCADE, verbose_name=_('event type'), related_name='agent_resource_types') lead_time = models.IntegerField(_('lead time'), default=0, help_text=_("in days")) value = models.DecimalField(_('value'), max_digits=8, decimal_places=2, default=Decimal("0.0")) - unit_of_value = models.ForeignKey(Unit, blank=True, null=True, + unit_of_value = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={'unit_type': 'value'}, verbose_name=_('unit of value'), related_name="agent_resource_value_units") value_per_unit = models.DecimalField(_('value per unit'), max_digits=8, decimal_places=2, default=Decimal("0.0")) description = models.TextField(_('description'), null=True, blank=True) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='arts_created', blank=True, null=True, editable=False) + related_name='arts_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='arts_changed', blank=True, null=True, editable=False) + related_name='arts_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) @@ -7239,11 +7239,11 @@ def __unicode__(self): class AgentResourceRole(models.Model): - agent = models.ForeignKey(EconomicAgent, + agent = models.ForeignKey(EconomicAgent, on_delete=models.CASCADE, verbose_name=_('agent'), related_name='agent_resource_roles') - resource = models.ForeignKey(EconomicResource, + resource = models.ForeignKey(EconomicResource, on_delete=models.CASCADE, verbose_name=_('resource'), related_name='agent_resource_roles') - role = models.ForeignKey(AgentResourceRoleType, + role = models.ForeignKey(AgentResourceRoleType, on_delete=models.CASCADE, verbose_name=_('role'), related_name='agent_resource_roles') is_contact = models.BooleanField(_('is contact'), default=False) owner_percentage = models.IntegerField(_('owner percentage'), null=True) @@ -7254,24 +7254,24 @@ def __unicode__(self): #todo: rename to CommitmentType class ProcessTypeResourceType(models.Model): - process_type = models.ForeignKey(ProcessType, + process_type = models.ForeignKey(ProcessType, on_delete=models.CASCADE, verbose_name=_('process type'), related_name='resource_types') - resource_type = models.ForeignKey(EconomicResourceType, + resource_type = models.ForeignKey(EconomicResourceType, on_delete=models.CASCADE, verbose_name=_('resource type'), related_name='process_types') - event_type = models.ForeignKey(EventType, + event_type = models.ForeignKey(EventType, on_delete=models.CASCADE, verbose_name=_('event type'), related_name='process_resource_types') stage = models.ForeignKey(ProcessType, related_name="commitmenttypes_at_stage", - verbose_name=_('stage'), blank=True, null=True) + verbose_name=_('stage'), blank=True, null=True, on_delete=models.SET_NULL) state = models.ForeignKey(ResourceState, related_name="commitmenttypes_at_state", - verbose_name=_('state'), blank=True, null=True) + verbose_name=_('state'), blank=True, null=True, on_delete=models.SET_NULL) quantity = models.DecimalField(_('quantity'), max_digits=8, decimal_places=2, default=Decimal('0.00')) - unit_of_quantity = models.ForeignKey(Unit, blank=True, null=True, + unit_of_quantity = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit'), related_name="process_resource_qty_units") description = models.TextField(_('description'), null=True, blank=True) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='ptrts_created', blank=True, null=True, editable=False) + related_name='ptrts_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='ptrts_changed', blank=True, null=True, editable=False) + related_name='ptrts_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) @@ -7481,21 +7481,21 @@ def current_or_future_with_use(self): class Process(models.Model): name = models.CharField(_('name'), max_length=128) - parent = models.ForeignKey('self', blank=True, null=True, + parent = models.ForeignKey('self', blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('parent'), related_name='sub_processes', editable=False) process_pattern = models.ForeignKey(ProcessPattern, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('process pattern'), related_name='processes') process_type = models.ForeignKey(ProcessType, blank=True, null=True, verbose_name=_('process type'), related_name='processes', on_delete=models.SET_NULL) context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={"is_context": True,}, verbose_name=_('context agent'), related_name='processes') plan = models.ForeignKey(Order, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('plan'), related_name='processes') url = models.CharField(_('url'), max_length=255, blank=True) start_date = models.DateField(_('start date')) @@ -7504,9 +7504,9 @@ class Process(models.Model): finished = models.BooleanField(_('finished'), default=False) notes = models.TextField(_('notes'), blank=True) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='processes_created', blank=True, null=True, editable=False) + related_name='processes_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='processes_changed', blank=True, null=True, editable=False) + related_name='processes_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) slug = models.SlugField(_("Page name"), editable=False) @@ -8603,7 +8603,7 @@ class TransferType(models.Model): name = models.CharField(_('name'), max_length=128) sequence = models.IntegerField(_('sequence'), default=0) exchange_type = models.ForeignKey(ExchangeType, - verbose_name=_('exchange type'), related_name='transfer_types') + verbose_name=_('exchange type'), related_name='transfer_types', on_delete=models.CASCADE) description = models.TextField(_('description'), blank=True, null=True) is_contribution = models.BooleanField(_('is contribution'), default=False) is_to_distribute = models.BooleanField(_('is to distribute'), default=False) @@ -8613,15 +8613,15 @@ class TransferType(models.Model): give_agent_is_context = models.BooleanField(_('give agent is context'), default=False) receive_agent_is_context = models.BooleanField(_('receive agent is context'), default=False) give_agent_association_type = models.ForeignKey(AgentAssociationType, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('give agent association type'), related_name='transfer_types_give') receive_agent_association_type = models.ForeignKey(AgentAssociationType, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('receive agent association type'), related_name='transfer_types_receive') created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='transfer_types_created', blank=True, null=True, editable=False) + related_name='transfer_types_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='transfer_types_changed', blank=True, null=True, editable=False) + related_name='transfer_types_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) inherit_types = models.BooleanField(_('inherit resource types'), default=False) @@ -8846,9 +8846,9 @@ def show_name(self, agent=None, forced=False): class TransferTypeFacetValue(models.Model): transfer_type = models.ForeignKey(TransferType, - verbose_name=_('transfer type'), related_name='facet_values') + verbose_name=_('transfer type'), related_name='facet_values', on_delete=models.CASCADE) facet_value = models.ForeignKey(FacetValue, - verbose_name=_('facet value'), related_name='transfer_types') + verbose_name=_('facet value'), related_name='transfer_types', on_delete=models.CASCADE) class Meta: unique_together = ('transfer_type', 'facet_value') @@ -8958,34 +8958,34 @@ def exchanges_by_type(self, agent): class Exchange(models.Model): name = models.CharField(_('name'), blank=True, max_length=128) process_pattern = models.ForeignKey(ProcessPattern, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('pattern'), related_name='exchanges') use_case = models.ForeignKey(UseCase, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('use case'), related_name='exchanges') exchange_type = models.ForeignKey(ExchangeType, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('exchange type'), related_name='exchanges') context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={"is_context": True,}, verbose_name=_('context agent'), related_name='exchanges') url = models.CharField(_('url'), max_length=255, blank=True, null=True) start_date = models.DateField(_('start date')) notes = models.TextField(_('notes'), blank=True) supplier = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="exchanges_as_supplier", verbose_name=_('supplier')) customer = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="exchanges_as_customer", verbose_name=_('customer')) order = models.ForeignKey(Order, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="exchanges", verbose_name=_('order')) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='exchanges_created', blank=True, null=True, editable=False) + related_name='exchanges_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='exchanges_changed', blank=True, null=True, editable=False) + related_name='exchanges_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) slug = models.SlugField(_("Page name"), editable=False) @@ -9827,21 +9827,21 @@ def related_agents(self): class Transfer(models.Model): name = models.CharField(_('name'), blank=True, max_length=128) transfer_type = models.ForeignKey(TransferType, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('transfer type'), related_name='transfers') exchange = models.ForeignKey(Exchange, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('exchange'), related_name='transfers') context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={"is_context": True,}, verbose_name=_('context agent'), related_name='transfers') transfer_date = models.DateField(_('transfer date')) notes = models.TextField(_('notes'), blank=True) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='transfers_created', blank=True, null=True, editable=False) + related_name='transfers_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='transfers_changed', blank=True, null=True, editable=False) + related_name='transfers_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) slug = models.SlugField(_("Page name"), editable=False) @@ -10670,20 +10670,20 @@ class Feature(models.Model): # blank=True, null=True, # help_text=_("option selections will be limited to this category"), # limit_choices_to=Q(applies_to='Anything') | Q(applies_to='EconomicResourceType')) - product = models.ForeignKey(EconomicResourceType, + product = models.ForeignKey(EconomicResourceType, on_delete=models.CASCADE, related_name="features", verbose_name=_('product')) process_type = models.ForeignKey(ProcessType, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('process type'), related_name='features') - event_type = models.ForeignKey(EventType, + event_type = models.ForeignKey(EventType, on_delete=models.CASCADE, verbose_name=_('event type'), related_name='features') quantity = models.DecimalField(_('quantity'), max_digits=8, decimal_places=2, default=Decimal('0.00')) - unit_of_quantity = models.ForeignKey(Unit, blank=True, null=True, + unit_of_quantity = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit'), related_name="feature_units") created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='features_created', blank=True, null=True, editable=False) + related_name='features_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='features_changed', blank=True, null=True, editable=False) + related_name='features_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) @@ -10743,14 +10743,14 @@ def xbill_change_form(self): class Option(models.Model): - feature = models.ForeignKey(Feature, + feature = models.ForeignKey(Feature, on_delete=models.CASCADE, related_name="options", verbose_name=_('feature')) - component = models.ForeignKey(EconomicResourceType, + component = models.ForeignKey(EconomicResourceType, on_delete=models.CASCADE, related_name="options", verbose_name=_('component')) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='options_created', blank=True, null=True, editable=False) + related_name='options_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='options_changed', blank=True, null=True, editable=False) + related_name='options_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) @@ -10840,68 +10840,68 @@ def all_give(self): class Commitment(models.Model): order = models.ForeignKey(Order, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="commitments", verbose_name=_('order')) independent_demand = models.ForeignKey(Order, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="dependent_commitments", verbose_name=_('independent demand')) order_item = models.ForeignKey("self", - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="stream_commitments", verbose_name=_('order item')) - event_type = models.ForeignKey(EventType, + event_type = models.ForeignKey(EventType, on_delete=models.CASCADE, related_name="commitments", verbose_name=_('event type')) stage = models.ForeignKey(ProcessType, related_name="commitments_at_stage", - verbose_name=_('stage'), blank=True, null=True) + verbose_name=_('stage'), blank=True, null=True, on_delete=models.SET_NULL) exchange_stage = models.ForeignKey(ExchangeType, related_name="commitments_at_exchange_stage", - verbose_name=_('exchange stage'), blank=True, null=True) + verbose_name=_('exchange stage'), blank=True, null=True, on_delete=models.SET_NULL) state = models.ForeignKey(ResourceState, related_name="commitments_at_state", - verbose_name=_('state'), blank=True, null=True) + verbose_name=_('state'), blank=True, null=True, on_delete=models.SET_NULL) commitment_date = models.DateField(_('commitment date'), default=datetime.date.today) start_date = models.DateField(_('start date'), blank=True, null=True) due_date = models.DateField(_('due date')) finished = models.BooleanField(_('finished'), default=False) from_agent_type = models.ForeignKey(AgentType, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="given_commitments", verbose_name=_('from agent type')) from_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="given_commitments", verbose_name=_('from')) to_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="taken_commitments", verbose_name=_('to')) resource_type = models.ForeignKey(EconomicResourceType, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('resource type'), related_name='commitments') resource = models.ForeignKey(EconomicResource, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('resource'), related_name='commitments') process = models.ForeignKey(Process, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('process'), related_name='commitments') exchange = models.ForeignKey(Exchange, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('exchange'), related_name='commitments') transfer = models.ForeignKey(Transfer, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="commitments") context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={"is_context": True,}, verbose_name=_('context agent'), related_name='commitments') description = models.TextField(_('description'), null=True, blank=True) url = models.CharField(_('url'), max_length=255, blank=True) quantity = models.DecimalField(_('quantity'), max_digits=8, decimal_places=2) - unit_of_quantity = models.ForeignKey(Unit, blank=True, null=True, + unit_of_quantity = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit'), related_name="commitment_qty_units") quality = models.DecimalField(_('quality'), max_digits=3, decimal_places=0, default=Decimal("0")) value = models.DecimalField(_('value'), max_digits=8, decimal_places=2, default=Decimal("0.0")) - unit_of_value = models.ForeignKey(Unit, blank=True, null=True, + unit_of_value = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit of value'), related_name="commitment_value_units") created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='commitments_created', blank=True, null=True, editable=False) + related_name='commitments_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='commitments_changed', blank=True, null=True, editable=False) + related_name='commitments_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) slug = models.SlugField(_("Page name"), editable=False) @@ -12218,9 +12218,9 @@ class Reciprocity(models.Model): and the other commitment can reciprocate many initiating commitments. """ - initiating_commitment = models.ForeignKey(Commitment, + initiating_commitment = models.ForeignKey(Commitment, on_delete=models.CASCADE, related_name="initiated_commitments", verbose_name=_('initiating commitment')) - reciprocal_commitment = models.ForeignKey(Commitment, + reciprocal_commitment = models.ForeignKey(Commitment, on_delete=models.CASCADE, related_name="reciprocal_commitments", verbose_name=_('reciprocal commitment')) reciprocity_date = models.DateField(_('reciprocity date'), default=datetime.date.today) @@ -12244,9 +12244,9 @@ def clean(self): class SelectedOption(models.Model): - commitment = models.ForeignKey(Commitment, + commitment = models.ForeignKey(Commitment, on_delete=models.CASCADE, related_name="options", verbose_name=_('commitment')) - option = models.ForeignKey(Option, + option = models.ForeignKey(Option, on_delete=models.CASCADE, related_name="commitments", verbose_name=_('option')) class Meta: @@ -12365,7 +12365,7 @@ def update_summary(agent, context_agent, resource_type, event_type): class ValueEquation(models.Model): name = models.CharField(_('name'), max_length=255, blank=True) - context_agent = models.ForeignKey(EconomicAgent, + context_agent = models.ForeignKey(EconomicAgent, on_delete=models.CASCADE, limit_choices_to={"is_context": True,}, related_name="value_equations", verbose_name=_('context agent')) description = models.TextField(_('description'), null=True, blank=True) @@ -12375,7 +12375,7 @@ class ValueEquation(models.Model): live = models.BooleanField(_('live'), default=False, help_text=_("Make this value equation available for use in real distributions.")) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='value_equations_created', blank=True, null=True) + related_name='value_equations_created', blank=True, null=True, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) def __unicode__(self): @@ -12679,23 +12679,23 @@ def distributions(self, start=None, end=None): class Distribution(models.Model): name = models.CharField(_('name'), blank=True, max_length=128) process_pattern = models.ForeignKey(ProcessPattern, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('pattern'), related_name='distributions') context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, limit_choices_to={"is_context": True,}, verbose_name=_('context agent'), related_name='distributions') url = models.CharField(_('url'), max_length=255, blank=True, null=True) distribution_date = models.DateField(_('distribution date')) notes = models.TextField(_('notes'), blank=True) value_equation = models.ForeignKey(ValueEquation, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('value equation link'), related_name='distributions') value_equation_content = models.TextField(_('value equation formulas used'), null=True, blank=True) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='distributions_created', blank=True, null=True, editable=False) + related_name='distributions_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='distributions_changed', blank=True, null=True, editable=False) + related_name='distributions_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) slug = models.SlugField(_("Page name"), editable=False) @@ -12862,22 +12862,22 @@ def related_agent(self, agent=None): )""" class EconomicEvent(models.Model): - event_type = models.ForeignKey(EventType, + event_type = models.ForeignKey(EventType, on_delete=models.CASCADE, related_name="events", verbose_name=_('event type')) event_date = models.DateField(_('event date')) from_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="given_events", verbose_name=_('from')) to_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="taken_events", verbose_name=_('to')) - resource_type = models.ForeignKey(EconomicResourceType, + resource_type = models.ForeignKey(EconomicResourceType, on_delete=models.CASCADE, verbose_name=_('resource type'), related_name='events') resource = models.ForeignKey(EconomicResource, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('resource'), related_name='events') exchange_stage = models.ForeignKey(ExchangeType, related_name="events_creating_exchange_stage", - verbose_name=_('exchange stage'), blank=True, null=True) + verbose_name=_('exchange stage'), blank=True, null=True, on_delete=models.SET_NULL) process = models.ForeignKey(Process, blank=True, null=True, verbose_name=_('process'), related_name='events', @@ -12902,30 +12902,30 @@ class EconomicEvent(models.Model): url = models.CharField(_('url'), max_length=255, blank=True) description = models.TextField(_('description'), null=True, blank=True) quantity = models.DecimalField(_('quantity'), max_digits=8, decimal_places=2) - unit_of_quantity = models.ForeignKey(Unit, blank=True, null=True, + unit_of_quantity = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit'), related_name="event_qty_units") quality = models.DecimalField(_('quality'), max_digits=3, decimal_places=0, default=Decimal("0")) value = models.DecimalField(_('value'), max_digits=8, decimal_places=2, default=Decimal("0.0")) - unit_of_value = models.ForeignKey(Unit, blank=True, null=True, + unit_of_value = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit of value'), related_name="event_value_units") price = models.DecimalField(_('price'), max_digits=8, decimal_places=2, default=Decimal("0.0")) - unit_of_price = models.ForeignKey(Unit, blank=True, null=True, + unit_of_price = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit of price'), related_name="event_price_units") commitment = models.ForeignKey(Commitment, blank=True, null=True, verbose_name=_('fulfills commitment'), related_name="fulfillment_events", on_delete=models.SET_NULL) is_contribution = models.BooleanField(_('is contribution'), default=False) is_to_distribute = models.BooleanField(_('is to distribute'), default=False) - accounting_reference = models.ForeignKey(AccountingReference, blank=True, null=True, + accounting_reference = models.ForeignKey(AccountingReference, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('accounting reference'), related_name="events", help_text=_('optional reference to an accounting grouping')) event_reference = models.CharField(_('reference'), max_length=128, blank=True, null=True) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='events_created', blank=True, null=True, editable=False) + related_name='events_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='events_changed', blank=True, null=True, editable=False) + related_name='events_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) slug = models.SlugField(_("Page name"), editable=False) @@ -14179,10 +14179,10 @@ class DistributionValueEquation(models.Model): ''' distribution_date = models.DateField(_('distribution date')) exchange = models.ForeignKey(Exchange, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('exchange'), related_name='value_equation') value_equation_link = models.ForeignKey(ValueEquation, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('value equation link'), related_name='distributions_ve') value_equation_content = models.TextField(_('value equation formulas used'), null=True, blank=True) @@ -14250,21 +14250,21 @@ def shipments(self): class ValueEquationBucket(models.Model): name = models.CharField(_('name'), max_length=32) sequence = models.IntegerField(_('sequence'), default=0) - value_equation = models.ForeignKey(ValueEquation, + value_equation = models.ForeignKey(ValueEquation, on_delete=models.CASCADE, verbose_name=_('value equation'), related_name='buckets') filter_method = models.CharField(_('filter method'), null=True, blank=True, max_length=12, choices=FILTER_METHOD_CHOICES) percentage = models.DecimalField(_('bucket percentage'), max_digits=8, decimal_places=2, default=Decimal("0.0")) distribution_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="value_equation_buckets", verbose_name=_('distribution agent')) filter_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="value_equation_filter_buckets", verbose_name=_('filter agent')) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='buckets_created', blank=True, null=True, editable=False) + related_name='buckets_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='buckets_changed', blank=True, null=True, editable=False) + related_name='buckets_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) @@ -14596,9 +14596,9 @@ def filter_entry_form(self, data=None): ) class ValueEquationBucketRule(models.Model): - value_equation_bucket = models.ForeignKey(ValueEquationBucket, + value_equation_bucket = models.ForeignKey(ValueEquationBucket, on_delete=models.CASCADE, verbose_name=_('value equation bucket'), related_name='bucket_rules') - event_type = models.ForeignKey(EventType, + event_type = models.ForeignKey(EventType, on_delete=models.CASCADE, related_name="bucket_rules", verbose_name=_('event type')) filter_rule = models.TextField(_('filter rule'), null=True, blank=True) #todo: thinking we can get rid of division_rule, see if we have requirement @@ -14609,9 +14609,9 @@ class ValueEquationBucketRule(models.Model): claim_creation_equation = models.TextField(_('claim creation equation'), null=True, blank=True) created_by = models.ForeignKey(User, verbose_name=_('created by'), - related_name='rules_created', blank=True, null=True, editable=False) + related_name='rules_created', blank=True, null=True, editable=False, on_delete=models.SET_NULL) changed_by = models.ForeignKey(User, verbose_name=_('changed by'), - related_name='rules_changed', blank=True, null=True, editable=False) + related_name='rules_changed', blank=True, null=True, editable=False, on_delete=models.SET_NULL) created_date = models.DateField(auto_now_add=True, blank=True, null=True, editable=False) changed_date = models.DateField(auto_now=True, blank=True, null=True, editable=False) @@ -14742,29 +14742,29 @@ class IncomeEventDistribution(models.Model): distribution_date = models.DateField(_('distribution date')) #next field obsolete distribution = models.ForeignKey(Exchange, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('distribution'), related_name='cash_receipts', default=None) distribution_ref = models.ForeignKey(Distribution, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('distribution'), related_name='income_events') - income_event = models.ForeignKey(EconomicEvent, + income_event = models.ForeignKey(EconomicEvent, on_delete=models.CASCADE, related_name="distributions", verbose_name=_('income event')) quantity = models.DecimalField(_('quantity'), max_digits=8, decimal_places=2, default=Decimal("0.0")) - unit_of_quantity = models.ForeignKey(Unit, blank=True, null=True, + unit_of_quantity = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit'), related_name="units") class Claim(models.Model): value_equation_bucket_rule = models.ForeignKey(ValueEquationBucketRule, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="claims", verbose_name=_('value equation bucket rule')) claim_date = models.DateField(_('claim date')) has_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="has_claims", verbose_name=_('has')) against_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="claims_against", verbose_name=_('against')) context_agent = models.ForeignKey(EconomicAgent, blank=True, null=True, @@ -14773,7 +14773,7 @@ class Claim(models.Model): on_delete=models.SET_NULL) value = models.DecimalField(_('value'), max_digits=8, decimal_places=2, default=Decimal("0.0")) - unit_of_value = models.ForeignKey(Unit, blank=True, null=True, + unit_of_value = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit of value'), related_name="claim_value_units") original_value = models.DecimalField(_('original value'), max_digits=8, decimal_places=2, default=Decimal("0.0")) @@ -14847,13 +14847,13 @@ def distribution_events(self): class ClaimEvent(models.Model): event = models.ForeignKey(EconomicEvent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="claim_events", verbose_name=_('claim event')) - claim = models.ForeignKey(Claim, + claim = models.ForeignKey(Claim, on_delete=models.CASCADE, related_name="claim_events", verbose_name=_('claims')) claim_event_date = models.DateField(_('claim event date'), default=datetime.date.today) value = models.DecimalField(_('value'), max_digits=8, decimal_places=2) - unit_of_value = models.ForeignKey(Unit, blank=True, null=True, + unit_of_value = models.ForeignKey(Unit, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('unit of value'), related_name="claim_event_value_units") event_effect = models.CharField(_('event effect'), max_length=12, choices=EVENT_EFFECT_CHOICES) @@ -14923,15 +14923,15 @@ def quantity_formatted(self): #as soon as we also remove the value equation demo page, view, etc. class CachedEventSummary(models.Model): agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, related_name="cached_events", verbose_name=_('agent')) context_agent = models.ForeignKey(EconomicAgent, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('context agent'), related_name='context_cached_events') resource_type = models.ForeignKey(EconomicResourceType, - blank=True, null=True, + blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_('resource type'), related_name='cached_events') - event_type = models.ForeignKey(EventType, + event_type = models.ForeignKey(EventType, on_delete=models.CASCADE, verbose_name=_('event type'), related_name='cached_events') resource_type_rate = models.DecimalField(_('resource type rate'), max_digits=8, decimal_places=2, default=Decimal("1.0")) importance = models.DecimalField(_('importance'), max_digits=3, decimal_places=0, default=Decimal("1")) diff --git a/work/migrations/0001_initial.py b/work/migrations/0001_initial.py index f34bb0216..fbf3f9aa2 100644 --- a/work/migrations/0001_initial.py +++ b/work/migrations/0001_initial.py @@ -35,7 +35,7 @@ class Migration(migrations.Migration): ('how_do_you_know_fc', models.TextField(verbose_name='How do you know Freedom Coop?', blank=True)), ('known_member', models.TextField(verbose_name='Do you know any member already from FreedomCoop or FairCoop? If so, who?', blank=True)), ('comments_and_questions', models.TextField(verbose_name='Comments and questions', blank=True)), - ('agent', models.ForeignKey(related_name='membership_requests', blank=True, to='valueaccounting.EconomicAgent', help_text='this membership request became this EconomicAgent', null=True, verbose_name='agent')), + ('agent', models.ForeignKey(related_name='membership_requests', blank=True, to='valueaccounting.EconomicAgent', help_text='this membership request became this EconomicAgent', null=True, verbose_name='agent', on_delete=models.SET_NULL)), ], options={ }, diff --git a/work/migrations/0006_project_skillsuggestion.py b/work/migrations/0006_project_skillsuggestion.py index 522885167..200ba0593 100644 --- a/work/migrations/0006_project_skillsuggestion.py +++ b/work/migrations/0006_project_skillsuggestion.py @@ -20,7 +20,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('joining_style', models.CharField(default=b'moderated', max_length=12, verbose_name='joining style', choices=[(b'moderated', 'moderated'), (b'autojoin', 'autojoin')])), ('visibility', models.CharField(default=b'private', max_length=12, verbose_name='visibility', choices=[(b'private', 'private'), (b'FCmembers', 'only FC members'), (b'public', 'public')])), - ('agent', models.OneToOneField(related_name='project', verbose_name='agent', to='valueaccounting.EconomicAgent')), + ('agent', models.OneToOneField(related_name='project', verbose_name='agent', to='valueaccounting.EconomicAgent', on_delete=models.CASCADE)), ], ), migrations.CreateModel( @@ -29,7 +29,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('skill', models.CharField(help_text='A new skill that you want to offer that is not already listed', max_length=128, verbose_name='skill')), ('suggestion_date', models.DateField(auto_now_add=True, null=True)), - ('suggested_by', models.ForeignKey(related_name='skill_suggestion', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='suggested by')), + ('suggested_by', models.ForeignKey(related_name='skill_suggestion', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='suggested by', on_delete=models.SET_NULL)), ], ), ] diff --git a/work/migrations/0008_joinrequest.py b/work/migrations/0008_joinrequest.py index b7ba33a07..de7cce882 100644 --- a/work/migrations/0008_joinrequest.py +++ b/work/migrations/0008_joinrequest.py @@ -24,8 +24,8 @@ class Migration(migrations.Migration): ('email_address', models.EmailField(max_length=96, verbose_name='Email address')), ('phone_number', models.CharField(max_length=32, null=True, verbose_name='Phone number', blank=True)), ('address', models.CharField(max_length=255, null=True, verbose_name='Town/Region where you are based', blank=True)), - ('agent', models.ForeignKey(related_name='project_join_requests', blank=True, to='valueaccounting.EconomicAgent', help_text='this join request became this EconomicAgent', null=True, verbose_name='agent')), - ('project', models.ForeignKey(related_name='join_requests', verbose_name='project', to='work.Project', help_text='this join request is for joining this EconomicAgent')), + ('agent', models.ForeignKey(related_name='project_join_requests', blank=True, to='valueaccounting.EconomicAgent', help_text='this join request became this EconomicAgent', null=True, verbose_name='agent', on_delete=models.SET_NULL)), + ('project', models.ForeignKey(related_name='join_requests', verbose_name='project', to='work.Project', help_text='this join request is for joining this EconomicAgent', on_delete=models.CASCADE)), ], ), ] diff --git a/work/migrations/0010_auto_20160902_0436.py b/work/migrations/0010_auto_20160902_0436.py index 187c890ce..7b83d3e3c 100644 --- a/work/migrations/0010_auto_20160902_0436.py +++ b/work/migrations/0010_auto_20160902_0436.py @@ -15,12 +15,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='joinrequest', name='fobi_data', - field=models.OneToOneField(related_name='join_request', null=True, to='fobi_contrib_plugins_form_handlers_db_store.SavedFormDataEntry', blank=True, help_text='this join request is linked to this custom form (fobi SavedFormDataEntry)', verbose_name='custom fobi id'), + field=models.OneToOneField(related_name='join_request', null=True, to='fobi_contrib_plugins_form_handlers_db_store.SavedFormDataEntry', blank=True, help_text='this join request is linked to this custom form (fobi SavedFormDataEntry)', verbose_name='custom fobi id', on_delete=models.SET_NULL), ), migrations.AlterField( model_name='joinrequest', name='project', - field=models.ForeignKey(related_name='join_requests', verbose_name='project', to='work.Project', help_text='this join request is for joining this Project'), + field=models.ForeignKey(related_name='join_requests', verbose_name='project', to='work.Project', help_text='this join request is for joining this Project', on_delete=models.CASCADE), ), migrations.AlterField( model_name='joinrequest', diff --git a/work/migrations/0013_auto_20160913_1301.py b/work/migrations/0013_auto_20160913_1301.py index 08ef86f49..16c889a27 100644 --- a/work/migrations/0013_auto_20160913_1301.py +++ b/work/migrations/0013_auto_20160913_1301.py @@ -15,7 +15,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='skillsuggestion', name='resource_type', - field=models.ForeignKey(related_name='skill_suggestions', blank=True, to='valueaccounting.EconomicResourceType', help_text='this skill suggestion became this ResourceType', null=True, verbose_name='resource_type'), + field=models.ForeignKey(related_name='skill_suggestions', blank=True, to='valueaccounting.EconomicResourceType', help_text='this skill suggestion became this ResourceType', null=True, verbose_name='resource_type', on_delete=models.SET_NULL), ), migrations.AddField( model_name='skillsuggestion', diff --git a/work/migrations/0016_auto_20161016_0937.py b/work/migrations/0016_auto_20161016_0937.py index ab75363d8..5826a3a03 100644 --- a/work/migrations/0016_auto_20161016_0937.py +++ b/work/migrations/0016_auto_20161016_0937.py @@ -24,9 +24,9 @@ class Migration(migrations.Migration): ('quarter', models.IntegerField(verbose_name='quarter')), ('sequence', models.IntegerField(verbose_name='sequence')), ('created_date', models.DateField(auto_now_add=True)), - ('created_by', models.ForeignKey(related_name='invoice_numbers_created', editable=False, to=settings.AUTH_USER_MODEL, verbose_name='created by')), - ('exchange', models.ForeignKey(related_name='invoice_numbers', verbose_name='exchange', blank=True, to='valueaccounting.Exchange', null=True)), - ('member', models.ForeignKey(related_name='invoice_numbers', verbose_name='member', to='valueaccounting.EconomicAgent')), + ('created_by', models.ForeignKey(related_name='invoice_numbers_created', editable=False, to=settings.AUTH_USER_MODEL, verbose_name='created by', on_delete=models.SET_NULL)), + ('exchange', models.ForeignKey(related_name='invoice_numbers', verbose_name='exchange', blank=True, to='valueaccounting.Exchange', null=True, on_delete=models.SET_NULL)), + ('member', models.ForeignKey(related_name='invoice_numbers', verbose_name='member', to='valueaccounting.EconomicAgent', on_delete=models.CASCADE)), ], options={ 'ordering': ('-invoice_date',), diff --git a/work/migrations/0018_ocp_material_type_ocp_nonmaterial_type_ocp_record_type.py b/work/migrations/0018_ocp_material_type_ocp_nonmaterial_type_ocp_record_type.py index 6fd38e8b9..b30137286 100644 --- a/work/migrations/0018_ocp_material_type_ocp_nonmaterial_type_ocp_record_type.py +++ b/work/migrations/0018_ocp_material_type_ocp_nonmaterial_type_ocp_record_type.py @@ -16,9 +16,9 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Ocp_Material_Type', fields=[ - ('material_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Material_Type')), - ('facet_value', models.OneToOneField(related_name='ocp_material_type', null=True, to='valueaccounting.FacetValue', blank=True, help_text='a related OCP FacetValue', verbose_name='ocp facet_value')), - ('resource_type', models.OneToOneField(related_name='ocp_material_type', null=True, to='valueaccounting.EconomicResourceType', blank=True, help_text='a related OCP ResourceType', verbose_name='ocp resource_type')), + ('material_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Material_Type', on_delete=models.CASCADE)), + ('facet_value', models.OneToOneField(related_name='ocp_material_type', null=True, to='valueaccounting.FacetValue', blank=True, help_text='a related OCP FacetValue', verbose_name='ocp facet_value', on_delete=models.SET_NULL)), + ('resource_type', models.OneToOneField(related_name='ocp_material_type', null=True, to='valueaccounting.EconomicResourceType', blank=True, help_text='a related OCP ResourceType', verbose_name='ocp resource_type', on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Type of General Material Resources', @@ -29,9 +29,9 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Ocp_Nonmaterial_Type', fields=[ - ('nonmaterial_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Nonmaterial_Type')), - ('facet_value', models.OneToOneField(related_name='ocp_nonmaterial_type', null=True, to='valueaccounting.FacetValue', blank=True, help_text='a related OCP FacetValue', verbose_name='ocp facet_value')), - ('resource_type', models.OneToOneField(related_name='ocp_nonmaterial_type', null=True, to='valueaccounting.EconomicResourceType', blank=True, help_text='a related OCP ResourceType', verbose_name='ocp resource_type')), + ('nonmaterial_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Nonmaterial_Type', on_delete=models.CASCADE)), + ('facet_value', models.OneToOneField(related_name='ocp_nonmaterial_type', null=True, to='valueaccounting.FacetValue', blank=True, help_text='a related OCP FacetValue', verbose_name='ocp facet_value', on_delete=models.SET_NULL)), + ('resource_type', models.OneToOneField(related_name='ocp_nonmaterial_type', null=True, to='valueaccounting.EconomicResourceType', blank=True, help_text='a related OCP ResourceType', verbose_name='ocp resource_type', on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Type of General Non-material Resources', @@ -42,8 +42,8 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Ocp_Record_Type', fields=[ - ('record_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Record_Type')), - ('exchange_type', models.ForeignKey(related_name='ocp_record_types', verbose_name='ocp exchange type', blank=True, to='valueaccounting.ExchangeType', null=True)), + ('record_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Record_Type', on_delete=models.CASCADE)), + ('exchange_type', models.ForeignKey(related_name='ocp_record_types', verbose_name='ocp exchange type', blank=True, to='valueaccounting.ExchangeType', null=True, on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Type of General Record', diff --git a/work/migrations/0019_auto_20161207_1438.py b/work/migrations/0019_auto_20161207_1438.py index 12a43bf8d..7fd08a38c 100644 --- a/work/migrations/0019_auto_20161207_1438.py +++ b/work/migrations/0019_auto_20161207_1438.py @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='ocp_record_type', name='exchange_type', - field=models.OneToOneField(related_name='ocp_record_type', null=True, blank=True, to='valueaccounting.ExchangeType', verbose_name='ocp exchange type'), + field=models.OneToOneField(related_name='ocp_record_type', null=True, blank=True, to='valueaccounting.ExchangeType', verbose_name='ocp exchange type', on_delete=models.SET_NULL), ), ] diff --git a/work/migrations/0020_ocp_skill_type.py b/work/migrations/0020_ocp_skill_type.py index 00dedb493..51664659d 100644 --- a/work/migrations/0020_ocp_skill_type.py +++ b/work/migrations/0020_ocp_skill_type.py @@ -16,9 +16,9 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Ocp_Skill_Type', fields=[ - ('job', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Job')), - ('facet_value', models.OneToOneField(related_name='ocp_skill_type', null=True, to='valueaccounting.FacetValue', blank=True, help_text='a related OCP FacetValue', verbose_name='ocp facet_value')), - ('resource_type', models.OneToOneField(related_name='ocp_skill_type', null=True, to='valueaccounting.EconomicResourceType', blank=True, help_text='a related OCP ResourceType', verbose_name='ocp resource_type')), + ('job', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Job', on_delete=models.CASCADE)), + ('facet_value', models.OneToOneField(related_name='ocp_skill_type', null=True, to='valueaccounting.FacetValue', blank=True, help_text='a related OCP FacetValue', verbose_name='ocp facet_value', on_delete=models.SET_NULL)), + ('resource_type', models.OneToOneField(related_name='ocp_skill_type', null=True, to='valueaccounting.EconomicResourceType', blank=True, help_text='a related OCP ResourceType', verbose_name='ocp resource_type', on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Type of General Skill Resources', diff --git a/work/migrations/0021_ocp_artwork_type.py b/work/migrations/0021_ocp_artwork_type.py index 9691261f7..2368d87f2 100644 --- a/work/migrations/0021_ocp_artwork_type.py +++ b/work/migrations/0021_ocp_artwork_type.py @@ -17,13 +17,13 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Ocp_Artwork_Type', fields=[ - ('artwork_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Artwork_Type')), - ('context_agent', models.ForeignKey(related_name='ocp_artwork_types', blank=True, to='valueaccounting.EconomicAgent', help_text='a related context EconomicAgent', null=True, verbose_name='context agent')), - ('facet', models.OneToOneField(related_name='ocp_artwork_type', null=True, to='valueaccounting.Facet', blank=True, help_text='a related OCP Facet', verbose_name='ocp facet')), - ('facet_value', models.ForeignKey(related_name='ocp_artwork_type', blank=True, to='valueaccounting.FacetValue', help_text='a related OCP FacetValue', null=True, verbose_name='ocp facet_value')), - ('material_type', mptt.fields.TreeForeignKey(related_name='ocp_artwork_types', blank=True, to='general.Material_Type', help_text='a related General Material Type', null=True, verbose_name='general material_type')), - ('nonmaterial_type', mptt.fields.TreeForeignKey(related_name='ocp_artwork_types', blank=True, to='general.Nonmaterial_Type', help_text='a related General Non-material Type', null=True, verbose_name='general nonmaterial_type')), - ('resource_type', models.OneToOneField(related_name='ocp_artwork_type', null=True, to='valueaccounting.EconomicResourceType', blank=True, help_text='a related OCP ResourceType', verbose_name='ocp resource_type')), + ('artwork_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Artwork_Type', on_delete=models.CASCADE)), + ('context_agent', models.ForeignKey(related_name='ocp_artwork_types', blank=True, to='valueaccounting.EconomicAgent', help_text='a related context EconomicAgent', null=True, verbose_name='context agent', on_delete=models.SET_NULL)), + ('facet', models.OneToOneField(related_name='ocp_artwork_type', null=True, to='valueaccounting.Facet', blank=True, help_text='a related OCP Facet', verbose_name='ocp facet', on_delete=models.SET_NULL)), + ('facet_value', models.ForeignKey(related_name='ocp_artwork_type', blank=True, to='valueaccounting.FacetValue', help_text='a related OCP FacetValue', null=True, verbose_name='ocp facet_value', on_delete=models.SET_NULL)), + ('material_type', mptt.fields.TreeForeignKey(related_name='ocp_artwork_types', blank=True, to='general.Material_Type', help_text='a related General Material Type', null=True, verbose_name='general material_type', on_delete=models.SET_NULL)), + ('nonmaterial_type', mptt.fields.TreeForeignKey(related_name='ocp_artwork_types', blank=True, to='general.Nonmaterial_Type', help_text='a related General Non-material Type', null=True, verbose_name='general nonmaterial_type', on_delete=models.SET_NULL)), + ('resource_type', models.OneToOneField(related_name='ocp_artwork_type', null=True, to='valueaccounting.EconomicResourceType', blank=True, help_text='a related OCP ResourceType', verbose_name='ocp resource_type', on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Type of General Artwork/Resource', diff --git a/work/migrations/0023_auto_20170121_0004.py b/work/migrations/0023_auto_20170121_0004.py index 885c23d9a..0e1ecb3b9 100644 --- a/work/migrations/0023_auto_20170121_0004.py +++ b/work/migrations/0023_auto_20170121_0004.py @@ -15,16 +15,16 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ocp_record_type', name='ocp_artwork_type', - field=mptt.fields.TreeForeignKey(related_name='ocp_record_types', blank=True, to='work.Ocp_Artwork_Type', help_text='a related General Artwork Type', null=True, verbose_name='general artwork_type'), + field=mptt.fields.TreeForeignKey(related_name='ocp_record_types', blank=True, to='work.Ocp_Artwork_Type', help_text='a related General Artwork Type', null=True, verbose_name='general artwork_type', on_delete=models.SET_NULL), ), migrations.AddField( model_name='ocp_skill_type', name='ocp_artwork_type', - field=mptt.fields.TreeForeignKey(related_name='ocp_skill_types', blank=True, to='work.Ocp_Artwork_Type', help_text='a related General Artwork Type', null=True, verbose_name='general artwork_type'), + field=mptt.fields.TreeForeignKey(related_name='ocp_skill_types', blank=True, to='work.Ocp_Artwork_Type', help_text='a related General Artwork Type', null=True, verbose_name='general artwork_type', on_delete=models.SET_NULL), ), migrations.AlterField( model_name='ocp_artwork_type', name='context_agent', - field=models.ForeignKey(related_name='ocp_artwork_types', blank=True, to='valueaccounting.EconomicAgent', help_text='a related OCP context EconomicAgent', null=True, verbose_name='context agent'), + field=models.ForeignKey(related_name='ocp_artwork_types', blank=True, to='valueaccounting.EconomicAgent', help_text='a related OCP context EconomicAgent', null=True, verbose_name='context agent', on_delete=models.SET_NULL), ), ] diff --git a/work/migrations/0024_ocp_unit_type.py b/work/migrations/0024_ocp_unit_type.py index ffcc9175b..3bfdf2636 100644 --- a/work/migrations/0024_ocp_unit_type.py +++ b/work/migrations/0024_ocp_unit_type.py @@ -16,9 +16,9 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Ocp_Unit_Type', fields=[ - ('unit_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Unit_Type')), - ('ocp_unit', models.OneToOneField(related_name='ocp_unit_type', null=True, to='valueaccounting.Unit', blank=True, help_text='a related OCP Unit', verbose_name='ocp unit')), - ('unit', models.OneToOneField(related_name='ocp_unit_type', null=True, to='general.Unit', blank=True, help_text='a related General Unit', verbose_name='general unit')), + ('unit_type', models.OneToOneField(parent_link=True, primary_key=True, serialize=False, to='general.Unit_Type', on_delete=models.CASCADE)), + ('ocp_unit', models.OneToOneField(related_name='ocp_unit_type', null=True, to='valueaccounting.Unit', blank=True, help_text='a related OCP Unit', verbose_name='ocp unit', on_delete=models.SET_NULL)), + ('unit', models.OneToOneField(related_name='ocp_unit_type', null=True, to='general.Unit', blank=True, help_text='a related General Unit', verbose_name='general unit', on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Type of General Unit', diff --git a/work/migrations/0025_ocp_skill_type_facet.py b/work/migrations/0025_ocp_skill_type_facet.py index 5e339136f..0210171f6 100644 --- a/work/migrations/0025_ocp_skill_type_facet.py +++ b/work/migrations/0025_ocp_skill_type_facet.py @@ -15,6 +15,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ocp_skill_type', name='facet', - field=models.OneToOneField(related_name='ocp_skill_type', null=True, to='valueaccounting.Facet', blank=True, help_text='a related OCP Facet', verbose_name='ocp facet'), + field=models.OneToOneField(related_name='ocp_skill_type', null=True, to='valueaccounting.Facet', blank=True, help_text='a related OCP Facet', verbose_name='ocp facet', on_delete=models.SET_NULL), ), ] diff --git a/work/migrations/0026_ocp_record_type_ocp_skill_type.py b/work/migrations/0026_ocp_record_type_ocp_skill_type.py index e952088c5..a0efaf937 100644 --- a/work/migrations/0026_ocp_record_type_ocp_skill_type.py +++ b/work/migrations/0026_ocp_record_type_ocp_skill_type.py @@ -15,6 +15,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ocp_record_type', name='ocp_skill_type', - field=mptt.fields.TreeForeignKey(related_name='ocp_record_types', blank=True, to='work.Ocp_Skill_Type', help_text='a related General Skill Type', null=True, verbose_name='general skill_type'), + field=mptt.fields.TreeForeignKey(related_name='ocp_record_types', blank=True, to='work.Ocp_Skill_Type', help_text='a related General Skill Type', null=True, verbose_name='general skill_type', on_delete=models.SET_NULL), ), ] diff --git a/work/migrations/0027_ocp_artwork_type_unit_type.py b/work/migrations/0027_ocp_artwork_type_unit_type.py index 1723faa91..4793e8ed1 100644 --- a/work/migrations/0027_ocp_artwork_type_unit_type.py +++ b/work/migrations/0027_ocp_artwork_type_unit_type.py @@ -16,6 +16,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ocp_artwork_type', name='unit_type', - field=mptt.fields.TreeForeignKey(related_name='ocp_artwork_types', blank=True, to='general.Unit_Type', help_text='a related General Unit Type', null=True, verbose_name='general unit_type'), + field=mptt.fields.TreeForeignKey(related_name='ocp_artwork_types', blank=True, to='general.Unit_Type', help_text='a related General Unit Type', null=True, verbose_name='general unit_type', on_delete=models.SET_NULL), ), ] diff --git a/work/models.py b/work/models.py index 4e40d4f32..e4568460f 100644 --- a/work/models.py +++ b/work/models.py @@ -97,7 +97,8 @@ class MembershipRequest(models.Model): agent = models.ForeignKey(EconomicAgent, verbose_name=_('agent'), related_name='membership_requests', blank=True, null=True, - help_text=_("this membership request became this EconomicAgent")) + help_text=_("this membership request became this EconomicAgent"), + on_delete=models.SET_NULL) state = models.CharField(_('state'), max_length=12, choices=REQUEST_STATE_CHOICES, default='new', editable=False)