Skip to content

Commit

Permalink
add language code column to import and export
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlamallama committed Jan 28, 2025
1 parent 3c54183 commit 0025840
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
14 changes: 11 additions & 3 deletions home/export_content_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@
from wagtail.models import Locale, Page # type: ignore
from wagtail.query import PageQuerySet # type: ignore

from .models import (ContentPage, ContentPageIndex, HomePage, MessengerBlock,
SMSBlock, USSDBlock, VariationBlock, ViberBlock,
WhatsappBlock)
from .models import (
ContentPage,
ContentPageIndex,
HomePage,
MessengerBlock,
SMSBlock,
USSDBlock,
VariationBlock,
ViberBlock,
WhatsappBlock,
)
from .xlsx_helpers import get_active_sheet

HP_CTYPE = HomePage._meta.verbose_name
Expand Down
29 changes: 19 additions & 10 deletions home/import_content_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,32 @@
from typing import Any
from uuid import uuid4

from django.core.exceptions import (ObjectDoesNotExist, # type: ignore
ValidationError)
from django.core.exceptions import ObjectDoesNotExist, ValidationError # type: ignore
from taggit.models import Tag # type: ignore
from treebeard.exceptions import NodeAlreadySaved # type: ignore
from wagtail.blocks import StructValue # type: ignore; type: ignore
from wagtail.blocks import ( # type: ignore
StructValue, # type: ignore
)
from wagtail.coreutils import get_content_languages # type: ignore
from wagtail.models import Locale, Page # type: ignore
from wagtail.models.sites import Site # type: ignore
from wagtail.rich_text import RichText # type: ignore

from home.import_helpers import (ImportException, parse_file,
validate_using_form)

from .models import (Assessment, ContentPage, ContentPageIndex,
ContentQuickReply, ContentTrigger, HomePage,
MessengerBlock, SMSBlock, USSDBlock, ViberBlock,
WhatsappBlock)
from home.import_helpers import ImportException, parse_file, validate_using_form

from .models import (
Assessment,
ContentPage,
ContentPageIndex,
ContentQuickReply,
ContentTrigger,
HomePage,
MessengerBlock,
SMSBlock,
USSDBlock,
ViberBlock,
WhatsappBlock,
)

PageId = tuple[str, Locale]

Expand Down
3 changes: 1 addition & 2 deletions home/tests/test_content_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,8 +1651,7 @@ def test_invalid_page_already_in_db(self, csv_impexp: ImportExport) -> None:
]

def test_language_code_import(self, csv_impexp: ImportExport) -> None:
"""
"""
""" """
csv_impexp.import_file("language_code_import.csv")
content = csv_impexp.export_content()

Expand Down

0 comments on commit 0025840

Please sign in to comment.