From 19c7a8a843bb49517dde291e0582d21a6919301a Mon Sep 17 00:00:00 2001 From: k9845 Date: Mon, 19 Feb 2024 14:51:31 +0545 Subject: [PATCH 1/2] Remove unwanted fields from translation --- api/admin.py | 6 +- api/migrations/0189_auto_20240219_0904.py | 77 ++++++ api/serializers.py | 4 +- api/snapshots/snap_test_views.py | 279 +++++++++++----------- api/translation.py | 12 - 5 files changed, 227 insertions(+), 151 deletions(-) create mode 100644 api/migrations/0189_auto_20240219_0904.py diff --git a/api/admin.py b/api/admin.py index 3e415f9ed..63c4fc954 100644 --- a/api/admin.py +++ b/api/admin.py @@ -172,11 +172,11 @@ class EventContactInline(admin.TabularInline): model = models.EventContact -class SituationReportInline(admin.TabularInline, TranslationInlineModelAdmin): +class SituationReportInline(admin.TabularInline): model = models.SituationReport -class EventFeaturedDocumentInline(admin.TabularInline, TranslationInlineModelAdmin): +class EventFeaturedDocumentInline(admin.TabularInline): model = models.EventFeaturedDocument @@ -599,7 +599,7 @@ def get_actions(self, request): return actions -class SituationReportAdmin(CompareVersionAdmin, RegionRestrictedAdmin, TranslationAdmin): +class SituationReportAdmin(CompareVersionAdmin, RegionRestrictedAdmin): search_fields = ('name', 'event__name',) list_display = ('name', 'link_to_event', 'type', 'visibility',) country_in = 'event__countries__in' diff --git a/api/migrations/0189_auto_20240219_0904.py b/api/migrations/0189_auto_20240219_0904.py new file mode 100644 index 000000000..d976f9209 --- /dev/null +++ b/api/migrations/0189_auto_20240219_0904.py @@ -0,0 +1,77 @@ +# Generated by Django 3.2.23 on 2024-02-19 09:04 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0188_auto_20240109_0508'), + ] + + operations = [ + migrations.RemoveField( + model_name='eventfeatureddocument', + name='description_ar', + ), + migrations.RemoveField( + model_name='eventfeatureddocument', + name='description_en', + ), + migrations.RemoveField( + model_name='eventfeatureddocument', + name='description_es', + ), + migrations.RemoveField( + model_name='eventfeatureddocument', + name='description_fr', + ), + migrations.RemoveField( + model_name='eventfeatureddocument', + name='title_ar', + ), + migrations.RemoveField( + model_name='eventfeatureddocument', + name='title_en', + ), + migrations.RemoveField( + model_name='eventfeatureddocument', + name='title_es', + ), + migrations.RemoveField( + model_name='eventfeatureddocument', + name='title_fr', + ), + migrations.RemoveField( + model_name='eventfeatureddocument', + name='translation_module_original_language', + ), + migrations.RemoveField( + model_name='eventfeatureddocument', + name='translation_module_skip_auto_translation', + ), + migrations.RemoveField( + model_name='situationreport', + name='name_ar', + ), + migrations.RemoveField( + model_name='situationreport', + name='name_en', + ), + migrations.RemoveField( + model_name='situationreport', + name='name_es', + ), + migrations.RemoveField( + model_name='situationreport', + name='name_fr', + ), + migrations.RemoveField( + model_name='situationreport', + name='translation_module_original_language', + ), + migrations.RemoveField( + model_name='situationreport', + name='translation_module_skip_auto_translation', + ), + ] diff --git a/api/serializers.py b/api/serializers.py index 0434a046d..d88188563 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -818,7 +818,7 @@ class Meta: ) -class EventFeaturedDocumentSerializer(ModelSerializer): +class EventFeaturedDocumentSerializer(serializers.ModelSerializer): class Meta: model = EventFeaturedDocument fields = ( @@ -1245,7 +1245,7 @@ class Meta: ) -class SituationReportSerializer(ModelSerializer): +class SituationReportSerializer(serializers.ModelSerializer): type = SituationReportTypeSerializer() visibility_display = serializers.CharField(source="get_visibility_display", read_only=True) diff --git a/api/snapshots/snap_test_views.py b/api/snapshots/snap_test_views.py index b6067fe7f..8512572dc 100644 --- a/api/snapshots/snap_test_views.py +++ b/api/snapshots/snap_test_views.py @@ -8,154 +8,165 @@ snapshots = Snapshot() snapshots['EventSnaphostTest::test_event_featured_document_api 1'] = { - "dtype": 1, - "countries": [], - "districts": [], - "summary": "NMGyDLJYVcCZKPmuMEGjdCgZvTfGPlcpTCCHHNkxxsyAXvRMdYOPvevgJRysqUQMjvfLQjwtPSQziMTftJyPYviQSVRHfPQBGxbxtlnvXFmoijesYgGXIVHcQvXNiMyjklSXNZkUCcAxRUpCNsWVYCoIptZYEmxRKCDXsXyGHAkmZMiqdPExJgTHhsfWkrCGjBfoCwbAdzGxpyfxobugTPvYjicsESiWTECNafbqnjJUMHBhXspthdpAOYNDehFMIbOGKpTjsBaNwpKAlQQfHxeHIGYGJbyEcOyxqVbwYewpUQOgXLVWvicwIvPlXRDSEOlZieTXDcsmcYmcutGzIEqcWPmswXdPvrhZxBzVCyvlFSFxZHrZfUBfBMlIsugfuQstCMTBkSCwCcUwNBrOYdeQOzxGZVRkbjMRYCciepXPxxyKcMjRCxxCWeKiHxzuPrphbVlFHyJhqXqTCnNsSFmhieClTCfZRuQwTeJIstkTTSOlYxGo", - "num_affected": 0, - "tab_two_title": "gupDhrCpjgdsyNApkuKUumWkFGDFtFbfzGDpnLwddsFMPREsIa", - "tab_three_title": "gBiqUxWzxczdKJmxJseyGCWJrNRNhigzxYvJxWjmMGzGccciTv", - "disaster_start_date": "2015-04-21T17:45:23.476445Z", - "created_at": "2008-01-01T00:00:00.123456Z", - "auto_generated": True, 'active_deployments': 0, - "appeals": [], - "contacts": [], - "key_figures": [], - "is_featured": False, - "is_featured_region": True, - "field_reports": [], - "hide_attached_field_reports": True, - "hide_field_report_map": True, - "updated_at": "2008-01-01T00:00:00.123456Z", - "id": 2, - "tab_one_title": "cPXKqPnXKANObFOIsPtEpZZRztDeSdkCAEDnvMjuTuUwziWxGJ", - "ifrc_severity_level": 0, - "ifrc_severity_level_display": "Yellow", - "parent_event": 1, - "glide": "xJKxDZJiNfetzTUEHA", - "featured_documents": [ - { - "id": 5, - "thumbnail": None, - "file": None, - "title": "event-featured-document-title-UEWunxuAcKoVjbqJLLUAsjmvoyKpFJPRvqWFUPVFDkUYwkiUIF", - "description": "event-featured-document-description-lIPdHceQdWaAiOoeTjanGDxdNOQNEQFbaIJAabHUrIsbGSRBZlggHjpmNHqwrYzfxzDKpSotRfPPWcfzyyJEdOaSkfFBPYvKgHco", - "translation_module_original_language": "en" - }, - { - "id": 4, - "thumbnail": None, - "file": None, - "title": "event-featured-document-title-pnegMcCMRTdpVczCoInWXdiGsoUKuKMXRuptjQHoAtrdJLVlOR", - "description": "event-featured-document-description-BJFdwPQyYHuSAAjtylWIEpotTjZDdJAAJHiypqnvPfCxfIUmdryRMMcemZWLUQJnEnvtanmVhVWEpSMTnzpJuXsyDIPwtqxGFDgZ", - "translation_module_original_language": "en" - }, - { - "id": 3, - "thumbnail": None, - "file": None, - "title": "event-featured-document-title-ShOsxNooiEjDVMxASJEWIZQnWpRWMYfHCHTxeKhdJGmKIjkuHC", - "description": "event-featured-document-description-hRnTLFfGCZdDiGADKdJDRZtUbzqaVnLecBwSeIdeEcsAlXiXPUPAxyCyyfRQIiPwhlIzHiUoaWbtDRUIBIyopDwjrmUWhcZQANXb", - "translation_module_original_language": "en" - }, - { - "id": 2, - "thumbnail": None, - "file": None, - "title": "event-featured-document-title-qVEnmIrJSrigNVLppdQHoOodgAvTEgRXiaJkAPEEPmWsusPdXf", - "description": "event-featured-document-description-PKoIVUclAlczYFlVscatKMgvsDPIHFiGDrmZhvkUDPqTlaVvYsKRWmlNOzBGufzQgliEupaqypCWrvtLUKaqPxSpdQhDtkzRGTXt", - "translation_module_original_language": "en" - }, - { - "id": 1, - "thumbnail": None, - "file": None, - "title": "event-featured-document-title-ZEHDjMGiuNukzNVtLvGGIFTKtEbxvRhALtYUSObMEqPYXLKoUd", - "description": "event-featured-document-description-LEkHOUNXyjRpcKShmbCuAjASnAGXNEVUdTiHnJuQEHyulDIvIwRXURPZSqNEmprJtotXsTnSTFuEwJYUrshKRIyzwXZjscsTfwCP", - "translation_module_original_language": "en" - } - ], - "links": [], - "emergency_response_contact_email": None, - "countries_for_preview": [], - "response_activity_count": 0, - "visibility": 3, - "name": "event-OhbVrpoiVgRVIfLBcbfnoGMbJmTPSIAoCLrZaWZkSBvrjnWvgf", - "slug": "ygwwmqzcudihyfjsonxkmtecqoxsfogyrdoxkxwnqrsrpemoki", - "translation_module_original_language": "en" + 'appeals': [ + ], + 'auto_generated': True, + 'contacts': [ + ], + 'countries': [ + ], + 'countries_for_preview': [ + ], + 'created_at': '2008-01-01T00:00:00.123456Z', + 'disaster_start_date': '2015-04-21T17:45:23.476445Z', + 'districts': [ + ], + 'dtype': 1, + 'emergency_response_contact_email': None, + 'featured_documents': [ + { + 'description': 'event-featured-document-description-lIPdHceQdWaAiOoeTjanGDxdNOQNEQFbaIJAabHUrIsbGSRBZlggHjpmNHqwrYzfxzDKpSotRfPPWcfzyyJEdOaSkfFBPYvKgHco', + 'file': None, + 'id': 5, + 'thumbnail': None, + 'title': 'event-featured-document-title-UEWunxuAcKoVjbqJLLUAsjmvoyKpFJPRvqWFUPVFDkUYwkiUIF' + }, + { + 'description': 'event-featured-document-description-BJFdwPQyYHuSAAjtylWIEpotTjZDdJAAJHiypqnvPfCxfIUmdryRMMcemZWLUQJnEnvtanmVhVWEpSMTnzpJuXsyDIPwtqxGFDgZ', + 'file': None, + 'id': 4, + 'thumbnail': None, + 'title': 'event-featured-document-title-pnegMcCMRTdpVczCoInWXdiGsoUKuKMXRuptjQHoAtrdJLVlOR' + }, + { + 'description': 'event-featured-document-description-hRnTLFfGCZdDiGADKdJDRZtUbzqaVnLecBwSeIdeEcsAlXiXPUPAxyCyyfRQIiPwhlIzHiUoaWbtDRUIBIyopDwjrmUWhcZQANXb', + 'file': None, + 'id': 3, + 'thumbnail': None, + 'title': 'event-featured-document-title-ShOsxNooiEjDVMxASJEWIZQnWpRWMYfHCHTxeKhdJGmKIjkuHC' + }, + { + 'description': 'event-featured-document-description-PKoIVUclAlczYFlVscatKMgvsDPIHFiGDrmZhvkUDPqTlaVvYsKRWmlNOzBGufzQgliEupaqypCWrvtLUKaqPxSpdQhDtkzRGTXt', + 'file': None, + 'id': 2, + 'thumbnail': None, + 'title': 'event-featured-document-title-qVEnmIrJSrigNVLppdQHoOodgAvTEgRXiaJkAPEEPmWsusPdXf' + }, + { + 'description': 'event-featured-document-description-LEkHOUNXyjRpcKShmbCuAjASnAGXNEVUdTiHnJuQEHyulDIvIwRXURPZSqNEmprJtotXsTnSTFuEwJYUrshKRIyzwXZjscsTfwCP', + 'file': None, + 'id': 1, + 'thumbnail': None, + 'title': 'event-featured-document-title-ZEHDjMGiuNukzNVtLvGGIFTKtEbxvRhALtYUSObMEqPYXLKoUd' + } + ], + 'field_reports': [ + ], + 'glide': 'xJKxDZJiNfetzTUEHA', + 'hide_attached_field_reports': True, + 'hide_field_report_map': True, + 'id': 2, + 'ifrc_severity_level': 0, + 'ifrc_severity_level_display': 'Yellow', + 'is_featured': False, + 'is_featured_region': True, + 'key_figures': [ + ], + 'links': [ + ], + 'name': 'event-OhbVrpoiVgRVIfLBcbfnoGMbJmTPSIAoCLrZaWZkSBvrjnWvgf', + 'num_affected': 0, + 'parent_event': 1, + 'response_activity_count': 0, + 'slug': 'ygwwmqzcudihyfjsonxkmtecqoxsfogyrdoxkxwnqrsrpemoki', + 'summary': 'NMGyDLJYVcCZKPmuMEGjdCgZvTfGPlcpTCCHHNkxxsyAXvRMdYOPvevgJRysqUQMjvfLQjwtPSQziMTftJyPYviQSVRHfPQBGxbxtlnvXFmoijesYgGXIVHcQvXNiMyjklSXNZkUCcAxRUpCNsWVYCoIptZYEmxRKCDXsXyGHAkmZMiqdPExJgTHhsfWkrCGjBfoCwbAdzGxpyfxobugTPvYjicsESiWTECNafbqnjJUMHBhXspthdpAOYNDehFMIbOGKpTjsBaNwpKAlQQfHxeHIGYGJbyEcOyxqVbwYewpUQOgXLVWvicwIvPlXRDSEOlZieTXDcsmcYmcutGzIEqcWPmswXdPvrhZxBzVCyvlFSFxZHrZfUBfBMlIsugfuQstCMTBkSCwCcUwNBrOYdeQOzxGZVRkbjMRYCciepXPxxyKcMjRCxxCWeKiHxzuPrphbVlFHyJhqXqTCnNsSFmhieClTCfZRuQwTeJIstkTTSOlYxGo', + 'tab_one_title': 'cPXKqPnXKANObFOIsPtEpZZRztDeSdkCAEDnvMjuTuUwziWxGJ', + 'tab_three_title': 'gBiqUxWzxczdKJmxJseyGCWJrNRNhigzxYvJxWjmMGzGccciTv', + 'tab_two_title': 'gupDhrCpjgdsyNApkuKUumWkFGDFtFbfzGDpnLwddsFMPREsIa', + 'translation_module_original_language': 'en', + 'updated_at': '2008-01-01T00:00:00.123456Z', + 'visibility': 3 } snapshots['EventSnaphostTest::test_event_link_api 1'] = { - "dtype": 1, - "countries": [], - "districts": [], - "summary": "NMGyDLJYVcCZKPmuMEGjdCgZvTfGPlcpTCCHHNkxxsyAXvRMdYOPvevgJRysqUQMjvfLQjwtPSQziMTftJyPYviQSVRHfPQBGxbxtlnvXFmoijesYgGXIVHcQvXNiMyjklSXNZkUCcAxRUpCNsWVYCoIptZYEmxRKCDXsXyGHAkmZMiqdPExJgTHhsfWkrCGjBfoCwbAdzGxpyfxobugTPvYjicsESiWTECNafbqnjJUMHBhXspthdpAOYNDehFMIbOGKpTjsBaNwpKAlQQfHxeHIGYGJbyEcOyxqVbwYewpUQOgXLVWvicwIvPlXRDSEOlZieTXDcsmcYmcutGzIEqcWPmswXdPvrhZxBzVCyvlFSFxZHrZfUBfBMlIsugfuQstCMTBkSCwCcUwNBrOYdeQOzxGZVRkbjMRYCciepXPxxyKcMjRCxxCWeKiHxzuPrphbVlFHyJhqXqTCnNsSFmhieClTCfZRuQwTeJIstkTTSOlYxGo", - "num_affected": 0, - "tab_two_title": "gupDhrCpjgdsyNApkuKUumWkFGDFtFbfzGDpnLwddsFMPREsIa", - "tab_three_title": "gBiqUxWzxczdKJmxJseyGCWJrNRNhigzxYvJxWjmMGzGccciTv", - "disaster_start_date": "2015-04-21T17:45:23.476445Z", - "created_at": "2008-01-01T00:00:00.123456Z", - "auto_generated": True, 'active_deployments': 0, - "appeals": [], - "contacts": [], - "key_figures": [], - "is_featured": False, - "is_featured_region": True, - "field_reports": [], - "hide_attached_field_reports": True, - "hide_field_report_map": True, - "updated_at": "2008-01-01T00:00:00.123456Z", - "id": 2, - "tab_one_title": "cPXKqPnXKANObFOIsPtEpZZRztDeSdkCAEDnvMjuTuUwziWxGJ", - "ifrc_severity_level": 0, - "ifrc_severity_level_display": "Yellow", - "parent_event": 1, - "glide": "xJKxDZJiNfetzTUEHA", - "featured_documents": [], - "links": [ + 'appeals': [ + ], + 'auto_generated': True, + 'contacts': [ + ], + 'countries': [ + ], + 'countries_for_preview': [ + ], + 'created_at': '2008-01-01T00:00:00.123456Z', + 'disaster_start_date': '2015-04-21T17:45:23.476445Z', + 'districts': [ + ], + 'dtype': 1, + 'emergency_response_contact_email': None, + 'featured_documents': [ + ], + 'field_reports': [ + ], + 'glide': 'xJKxDZJiNfetzTUEHA', + 'hide_attached_field_reports': True, + 'hide_field_report_map': True, + 'id': 2, + 'ifrc_severity_level': 0, + 'ifrc_severity_level_display': 'Yellow', + 'is_featured': False, + 'is_featured_region': True, + 'key_figures': [ + ], + 'links': [ { - "id": 5, - "url": "", - "description": "event-link-description-lIPdHceQdWaAiOoeTjanGDxdNOQNEQFbaIJAabHUrIsbGSRBZlggHjpmNHqwrYzfxzDKpSotRfPPWcfzyyJEdOaSkfFBPYvKgHco", - "title": "event-link-title-UEWunxuAcKoVjbqJLLUAsjmvoyKpFJPRvqWFUPVFDkUYwkiUIF", - "translation_module_original_language": "en" + 'description': 'event-link-description-lIPdHceQdWaAiOoeTjanGDxdNOQNEQFbaIJAabHUrIsbGSRBZlggHjpmNHqwrYzfxzDKpSotRfPPWcfzyyJEdOaSkfFBPYvKgHco', + 'id': 5, + 'title': 'event-link-title-UEWunxuAcKoVjbqJLLUAsjmvoyKpFJPRvqWFUPVFDkUYwkiUIF', + 'translation_module_original_language': 'en', + 'url': '' }, { - "id": 4, - "url": "", - "description": "event-link-description-BJFdwPQyYHuSAAjtylWIEpotTjZDdJAAJHiypqnvPfCxfIUmdryRMMcemZWLUQJnEnvtanmVhVWEpSMTnzpJuXsyDIPwtqxGFDgZ", - "title": "event-link-title-pnegMcCMRTdpVczCoInWXdiGsoUKuKMXRuptjQHoAtrdJLVlOR", - "translation_module_original_language": "en" + 'description': 'event-link-description-BJFdwPQyYHuSAAjtylWIEpotTjZDdJAAJHiypqnvPfCxfIUmdryRMMcemZWLUQJnEnvtanmVhVWEpSMTnzpJuXsyDIPwtqxGFDgZ', + 'id': 4, + 'title': 'event-link-title-pnegMcCMRTdpVczCoInWXdiGsoUKuKMXRuptjQHoAtrdJLVlOR', + 'translation_module_original_language': 'en', + 'url': '' }, { - "id": 3, - "url": "", - "description": "event-link-description-hRnTLFfGCZdDiGADKdJDRZtUbzqaVnLecBwSeIdeEcsAlXiXPUPAxyCyyfRQIiPwhlIzHiUoaWbtDRUIBIyopDwjrmUWhcZQANXb", - "title": "event-link-title-ShOsxNooiEjDVMxASJEWIZQnWpRWMYfHCHTxeKhdJGmKIjkuHC", - "translation_module_original_language": "en" + 'description': 'event-link-description-hRnTLFfGCZdDiGADKdJDRZtUbzqaVnLecBwSeIdeEcsAlXiXPUPAxyCyyfRQIiPwhlIzHiUoaWbtDRUIBIyopDwjrmUWhcZQANXb', + 'id': 3, + 'title': 'event-link-title-ShOsxNooiEjDVMxASJEWIZQnWpRWMYfHCHTxeKhdJGmKIjkuHC', + 'translation_module_original_language': 'en', + 'url': '' }, { - "id": 2, - "url": "", - "description": "event-link-description-PKoIVUclAlczYFlVscatKMgvsDPIHFiGDrmZhvkUDPqTlaVvYsKRWmlNOzBGufzQgliEupaqypCWrvtLUKaqPxSpdQhDtkzRGTXt", - "title": "event-link-title-qVEnmIrJSrigNVLppdQHoOodgAvTEgRXiaJkAPEEPmWsusPdXf", - "translation_module_original_language": "en" + 'description': 'event-link-description-PKoIVUclAlczYFlVscatKMgvsDPIHFiGDrmZhvkUDPqTlaVvYsKRWmlNOzBGufzQgliEupaqypCWrvtLUKaqPxSpdQhDtkzRGTXt', + 'id': 2, + 'title': 'event-link-title-qVEnmIrJSrigNVLppdQHoOodgAvTEgRXiaJkAPEEPmWsusPdXf', + 'translation_module_original_language': 'en', + 'url': '' }, { - "id": 1, - "url": "", - "description": "event-link-description-LEkHOUNXyjRpcKShmbCuAjASnAGXNEVUdTiHnJuQEHyulDIvIwRXURPZSqNEmprJtotXsTnSTFuEwJYUrshKRIyzwXZjscsTfwCP", - "title": "event-link-title-ZEHDjMGiuNukzNVtLvGGIFTKtEbxvRhALtYUSObMEqPYXLKoUd", - "translation_module_original_language": "en" + 'description': 'event-link-description-LEkHOUNXyjRpcKShmbCuAjASnAGXNEVUdTiHnJuQEHyulDIvIwRXURPZSqNEmprJtotXsTnSTFuEwJYUrshKRIyzwXZjscsTfwCP', + 'id': 1, + 'title': 'event-link-title-ZEHDjMGiuNukzNVtLvGGIFTKtEbxvRhALtYUSObMEqPYXLKoUd', + 'translation_module_original_language': 'en', + 'url': '' } ], - "emergency_response_contact_email": None, - "countries_for_preview": [], - "response_activity_count": 0, - "visibility": 3, - "name": "event-OhbVrpoiVgRVIfLBcbfnoGMbJmTPSIAoCLrZaWZkSBvrjnWvgf", - "slug": "ygwwmqzcudihyfjsonxkmtecqoxsfogyrdoxkxwnqrsrpemoki", - "translation_module_original_language": "en" + 'name': 'event-OhbVrpoiVgRVIfLBcbfnoGMbJmTPSIAoCLrZaWZkSBvrjnWvgf', + 'num_affected': 0, + 'parent_event': 1, + 'response_activity_count': 0, + 'slug': 'ygwwmqzcudihyfjsonxkmtecqoxsfogyrdoxkxwnqrsrpemoki', + 'summary': 'NMGyDLJYVcCZKPmuMEGjdCgZvTfGPlcpTCCHHNkxxsyAXvRMdYOPvevgJRysqUQMjvfLQjwtPSQziMTftJyPYviQSVRHfPQBGxbxtlnvXFmoijesYgGXIVHcQvXNiMyjklSXNZkUCcAxRUpCNsWVYCoIptZYEmxRKCDXsXyGHAkmZMiqdPExJgTHhsfWkrCGjBfoCwbAdzGxpyfxobugTPvYjicsESiWTECNafbqnjJUMHBhXspthdpAOYNDehFMIbOGKpTjsBaNwpKAlQQfHxeHIGYGJbyEcOyxqVbwYewpUQOgXLVWvicwIvPlXRDSEOlZieTXDcsmcYmcutGzIEqcWPmswXdPvrhZxBzVCyvlFSFxZHrZfUBfBMlIsugfuQstCMTBkSCwCcUwNBrOYdeQOzxGZVRkbjMRYCciepXPxxyKcMjRCxxCWeKiHxzuPrphbVlFHyJhqXqTCnNsSFmhieClTCfZRuQwTeJIstkTTSOlYxGo', + 'tab_one_title': 'cPXKqPnXKANObFOIsPtEpZZRztDeSdkCAEDnvMjuTuUwziWxGJ', + 'tab_three_title': 'gBiqUxWzxczdKJmxJseyGCWJrNRNhigzxYvJxWjmMGzGccciTv', + 'tab_two_title': 'gupDhrCpjgdsyNApkuKUumWkFGDFtFbfzGDpnLwddsFMPREsIa', + 'translation_module_original_language': 'en', + 'updated_at': '2008-01-01T00:00:00.123456Z', + 'visibility': 3 } diff --git a/api/translation.py b/api/translation.py index 867963bf6..ab0fee630 100644 --- a/api/translation.py +++ b/api/translation.py @@ -18,11 +18,9 @@ RegionEmergencySnippet, RegionProfileSnippet, RegionPreparednessSnippet, - SituationReport, SituationReportType, Snippet, SupportedActivity, - EventFeaturedDocument, EventLink, FieldReport, Source, @@ -119,11 +117,6 @@ class RegionPreparednessSnippetTO(TranslationOptions): fields = ('title', 'snippet',) -@register(SituationReport) -class SituationReportTO(TranslationOptions): - fields = ('name',) - - @register(SituationReportType) class SituationReportTypeTO(TranslationOptions): fields = ('type',) @@ -139,11 +132,6 @@ class SupportedActivityTO(TranslationOptions): fields = ('name',) -@register(EventFeaturedDocument) -class EventFeaturedDocumentTO(TranslationOptions): - fields = ('title', 'description') - - @register(EventLink) class EventLinkTO(TranslationOptions): fields = ('title', 'description') From d88c35bdc2cd009ad814f075b96859d5e845f7c0 Mon Sep 17 00:00:00 2001 From: k9845 Date: Tue, 20 Feb 2024 10:58:13 +0545 Subject: [PATCH 2/2] Add keyfigure translation in country,region and emergency --- api/admin.py | 6 +- api/migrations/0190_auto_20240220_0510.py | 73 +++++++++++++++++++++++ api/translation.py | 28 +++++++++ 3 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 api/migrations/0190_auto_20240220_0510.py diff --git a/api/admin.py b/api/admin.py index 63c4fc954..3ab299329 100644 --- a/api/admin.py +++ b/api/admin.py @@ -160,7 +160,7 @@ class DisasterTypeAdmin(CompareVersionAdmin, TranslationAdmin, admin.ModelAdmin) search_fields = ('name',) -class KeyFigureInline(admin.TabularInline): +class KeyFigureInline(admin.TabularInline, TranslationInlineModelAdmin): model = models.KeyFigure @@ -459,11 +459,11 @@ class GeneralDocumentAdmin(CompareVersionAdmin, RegionRestrictedAdmin, Translati search_fields = ('name', 'document') -class CountryKeyFigureInline(admin.TabularInline): +class CountryKeyFigureInline(admin.TabularInline, TranslationInlineModelAdmin): model = models.CountryKeyFigure -class RegionKeyFigureInline(admin.TabularInline): +class RegionKeyFigureInline(admin.TabularInline, TranslationInlineModelAdmin): model = models.RegionKeyFigure diff --git a/api/migrations/0190_auto_20240220_0510.py b/api/migrations/0190_auto_20240220_0510.py new file mode 100644 index 000000000..91c2a25e6 --- /dev/null +++ b/api/migrations/0190_auto_20240220_0510.py @@ -0,0 +1,73 @@ +# Generated by Django 3.2.23 on 2024-02-20 05:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0189_auto_20240219_0904'), + ] + + operations = [ + migrations.AddField( + model_name='adminkeyfigure', + name='deck_ar', + field=models.CharField(max_length=50, null=True, verbose_name='deck'), + ), + migrations.AddField( + model_name='adminkeyfigure', + name='deck_en', + field=models.CharField(max_length=50, null=True, verbose_name='deck'), + ), + migrations.AddField( + model_name='adminkeyfigure', + name='deck_es', + field=models.CharField(max_length=50, null=True, verbose_name='deck'), + ), + migrations.AddField( + model_name='adminkeyfigure', + name='deck_fr', + field=models.CharField(max_length=50, null=True, verbose_name='deck'), + ), + migrations.AddField( + model_name='adminkeyfigure', + name='translation_module_original_language', + field=models.CharField(choices=[('en', 'English'), ('es', 'Spanish'), ('fr', 'French'), ('ar', 'Arabic')], default='en', help_text='Language used to create this entity', max_length=2, verbose_name='Entity Original language'), + ), + migrations.AddField( + model_name='adminkeyfigure', + name='translation_module_skip_auto_translation', + field=models.BooleanField(default=False, help_text='Skip auto translation operation for this entity?', verbose_name='Skip auto translation'), + ), + migrations.AddField( + model_name='keyfigure', + name='deck_ar', + field=models.CharField(help_text='key figure units', max_length=50, null=True, verbose_name='deck'), + ), + migrations.AddField( + model_name='keyfigure', + name='deck_en', + field=models.CharField(help_text='key figure units', max_length=50, null=True, verbose_name='deck'), + ), + migrations.AddField( + model_name='keyfigure', + name='deck_es', + field=models.CharField(help_text='key figure units', max_length=50, null=True, verbose_name='deck'), + ), + migrations.AddField( + model_name='keyfigure', + name='deck_fr', + field=models.CharField(help_text='key figure units', max_length=50, null=True, verbose_name='deck'), + ), + migrations.AddField( + model_name='keyfigure', + name='translation_module_original_language', + field=models.CharField(choices=[('en', 'English'), ('es', 'Spanish'), ('fr', 'French'), ('ar', 'Arabic')], default='en', help_text='Language used to create this entity', max_length=2, verbose_name='Entity Original language'), + ), + migrations.AddField( + model_name='keyfigure', + name='translation_module_skip_auto_translation', + field=models.BooleanField(default=False, help_text='Skip auto translation operation for this entity?', verbose_name='Skip auto translation'), + ), + ] diff --git a/api/translation.py b/api/translation.py index ab0fee630..444fd86f8 100644 --- a/api/translation.py +++ b/api/translation.py @@ -24,6 +24,10 @@ EventLink, FieldReport, Source, + CountryKeyFigure, + RegionKeyFigure, + KeyFigure, + AdminKeyFigure ) @@ -142,3 +146,27 @@ class SourceTO(TranslationOptions): fields = ( 'spec', ) + + +@register(KeyFigure) +class KeyFigureTo(TranslationOptions): + fields = ( + 'deck', + ) + + +@register(AdminKeyFigure) +class AdminKeyFigureTo(TranslationOptions): + fields = ( + 'deck', + ) + + +@register(CountryKeyFigure) +class CountryKeyFigureTo(TranslationOptions): + pass + + +@register(RegionKeyFigure) +class RegionKeyFigureTo(TranslationOptions): + pass