-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#1427] Implemented OpenZaak status translation #748
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the built-in type
list
for the annotation since we don't need to support Python < 3.9There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should, but let's do it in one operation and sweep for all main PEP 585 containers: I created Taiga issue 1718 for it.