kopia lustrzana https://github.com/wagtail/wagtail
rodzic
fa1d79a432
commit
e5afd52dc0
|
@ -31,6 +31,7 @@ Changelog
|
|||
* Fix: Ensure that Snippets search results correctly use the `index_results.html` or `index_results_template_name` override on initial load (Stefan Hammer)
|
||||
* Fix: Avoid error when attempting to moderate a page drafted by a now deleted user (Dan Braghis)
|
||||
* Fix: Do not show multiple error messages when editing a Site to use existing hostname and port (Rohit Sharma)
|
||||
* Fix: Avoid error when exporting Aging Pages report where a page has an empty `last_published_by_user` (Chiemezuo Akujobi)
|
||||
* Docs: Document, for contributors, the use of translate string literals passed as arguments to tags and filters using `_()` within templates (Chiemezuo Akujobi)
|
||||
* Docs: Document all features for the Documents app in one location (Neeraj Yetheendran)
|
||||
* Docs: Add section to testing docs about creating pages and working with page content (Mariana Bedran Lesche)
|
||||
|
|
|
@ -44,6 +44,7 @@ depth: 1
|
|||
* Ensure that Snippets search results correctly use the `index_results.html` or `index_results_template_name` override on initial load (Stefan Hammer)
|
||||
* Avoid error when attempting to moderate a page drafted by a now deleted user (Dan Braghis)
|
||||
* Do not show multiple error messages when editing a Site to use existing hostname and port (Rohit Sharma)
|
||||
* Avoid error when exporting Aging Pages report where a page has an empty `last_published_by_user` (Chiemezuo Akujobi)
|
||||
|
||||
### Documentation
|
||||
|
||||
|
|
|
@ -631,6 +631,48 @@ class TestAgingPagesView(WagtailTestUtils, TestCase):
|
|||
|
||||
self.assertEqual(worksheet["C2"].number_format, ExcelDateFormatter().get())
|
||||
|
||||
def test_xlsx_export_without_published_by(self):
|
||||
"""
|
||||
Test that the xlsx export works when a page has no 'published_by' set.
|
||||
See https://github.com/wagtail/wagtail/issues/10821
|
||||
"""
|
||||
|
||||
self.home.save_revision().publish()
|
||||
|
||||
if settings.USE_TZ:
|
||||
self.home.last_published_at = "2013-01-01T12:00:00.000Z"
|
||||
else:
|
||||
self.home.last_published_at = "2013-01-01T12:00:00"
|
||||
|
||||
# mimic a page that does not have a 'published_by' on creation
|
||||
self.home.last_published_by = None
|
||||
self.home.save()
|
||||
|
||||
response = self.get(params={"export": "xlsx"})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
workbook_data = response.getvalue()
|
||||
worksheet = load_workbook(filename=BytesIO(workbook_data))["Sheet1"]
|
||||
cell_array = [[cell.value for cell in row] for row in worksheet.rows]
|
||||
|
||||
self.assertEqual(
|
||||
cell_array[0],
|
||||
["Title", "Status", "Last published at", "Last published by", "Type"],
|
||||
)
|
||||
self.assertEqual(
|
||||
cell_array[1],
|
||||
[
|
||||
"Welcome to your new Wagtail site!",
|
||||
"live + draft",
|
||||
datetime.datetime(2013, 1, 1, 12, 0),
|
||||
None,
|
||||
"Page",
|
||||
],
|
||||
)
|
||||
self.assertEqual(len(cell_array), 2)
|
||||
|
||||
self.assertEqual(worksheet["C2"].number_format, ExcelDateFormatter().get())
|
||||
|
||||
def test_report_renders_when_page_publisher_deleted(self):
|
||||
temp_user = self.create_superuser(
|
||||
"temp", email="temp@user.com", password="tempuser"
|
||||
|
|
|
@ -82,6 +82,8 @@ class AgingPagesView(PageReportView):
|
|||
user_id_value, get_deleted_user_display_name(user_id=user_id_value)
|
||||
)
|
||||
page.last_published_by_user = last_published_by_user
|
||||
else:
|
||||
page.last_published_by_user = ""
|
||||
|
||||
def decorate_paginated_queryset(self, queryset):
|
||||
user_ids = set(queryset.values_list("last_published_by", flat=True))
|
||||
|
|
Ładowanie…
Reference in New Issue