-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #748 from maykinmedia/feature/1427-status-translation
[#1427] Implemented OpenZaak status translation
- Loading branch information
Showing
19 changed files
with
384 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/open_inwoner/components/templates/components/status/status_list.html
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/open_inwoner/openzaak/migrations/0021_statustranslation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Generated by Django 3.2.20 on 2023-08-25 08:07 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
( | ||
"openzaak", | ||
"0020_rename_contact_moments_enabled_zaaktypeconfig_contact_form_enabled", | ||
), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="StatusTranslation", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"status", | ||
models.CharField( | ||
max_length=255, unique=True, verbose_name="Status tekst" | ||
), | ||
), | ||
( | ||
"translation", | ||
models.CharField(max_length=255, verbose_name="Vertaling"), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Status vertaling", | ||
"verbose_name_plural": "Status vertalingen", | ||
}, | ||
), | ||
] |
13 changes: 13 additions & 0 deletions
13
...pen_inwoner/openzaak/migrations/0023_merge_0021_statustranslation_0022_mark_as_is_sent.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Generated by Django 3.2.20 on 2023-09-04 10:33 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("openzaak", "0021_statustranslation"), | ||
("openzaak", "0022_mark_as_is_sent"), | ||
] | ||
|
||
operations = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from import_export import fields, resources | ||
from import_export.exceptions import ImportExportError | ||
|
||
from open_inwoner.openzaak.models import StatusTranslation | ||
|
||
|
||
class StatusTranslationImportResource(resources.ModelResource): | ||
def before_import(self, dataset, using_transactions, dry_run, **kwargs): | ||
# Validate that file contains all the headers | ||
missing_headers = set(self.get_diff_headers()) - set(dataset.headers) | ||
if missing_headers: | ||
missing_headers = ",\n".join(missing_headers) | ||
raise ImportExportError(_(f"Missing required headers: {missing_headers}")) | ||
|
||
return super().before_import(dataset, using_transactions, dry_run, **kwargs) | ||
|
||
def get_or_init_instance(self, instance_loader, row): | ||
# Replace newlines from excel | ||
for key, value in row.items(): | ||
if isinstance(value, str): | ||
row[key] = value.replace("_x000D_", "\n") | ||
|
||
return super().get_or_init_instance(instance_loader, row) | ||
|
||
status = fields.Field(column_name="status", attribute="status") | ||
translation = fields.Field(column_name="translation", attribute="translation") | ||
|
||
class Meta: | ||
model = StatusTranslation | ||
import_id_fields = ("status",) | ||
fields = ("status", "translation") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.