Skip to content

Commit

Permalink
Merge pull request #2046 from IFRCGo/feature/remove-unwanted-translat…
Browse files Browse the repository at this point in the history
…ion-fields

Translation fixes
  • Loading branch information
thenav56 authored Feb 26, 2024
2 parents 2ab1b27 + d88c35b commit 94e520f
Show file tree
Hide file tree
Showing 6 changed files with 331 additions and 154 deletions.
12 changes: 6 additions & 6 deletions api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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


Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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'
Expand Down
77 changes: 77 additions & 0 deletions api/migrations/0189_auto_20240219_0904.py
Original file line number Diff line number Diff line change
@@ -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',
),
]
73 changes: 73 additions & 0 deletions api/migrations/0190_auto_20240220_0510.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
4 changes: 2 additions & 2 deletions api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ class Meta:
)


class EventFeaturedDocumentSerializer(ModelSerializer):
class EventFeaturedDocumentSerializer(serializers.ModelSerializer):
class Meta:
model = EventFeaturedDocument
fields = (
Expand Down Expand Up @@ -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)

Expand Down
Loading

0 comments on commit 94e520f

Please sign in to comment.