From 4908db961ce62a18c0e1457fbc1573769a90be65 Mon Sep 17 00:00:00 2001 From: Will Barton Date: Tue, 16 Jul 2024 09:51:58 -0400 Subject: [PATCH] Upgrade Wagtail to 6.1 Co-Authored-By: Andy Chosak --- cfgov/jobmanager/models/django.py | 6 ++++++ cfgov/jobmanager/views.py | 13 ++++++------- cfgov/permissions_viewer/wagtail_hooks.py | 2 +- requirements/wagtail.txt | 2 +- test/cypress/integration/admin/admin-helpers.cy.js | 6 +++--- test/cypress/integration/admin/admin.cy.js | 2 +- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/cfgov/jobmanager/models/django.py b/cfgov/jobmanager/models/django.py index e83a6883c19..4361f68678d 100755 --- a/cfgov/jobmanager/models/django.py +++ b/cfgov/jobmanager/models/django.py @@ -92,6 +92,12 @@ class Meta: InlinePanel("major_cities", label="Major cities"), ] + def states_in_region(self): + return ", ".join(str(state) for state in self.states.all()) + + def major_city_names(self): + return "; ".join(str(city) for city in self.major_cities.all()) + class State(models.Model): name = models.CharField(max_length=255) diff --git a/cfgov/jobmanager/views.py b/cfgov/jobmanager/views.py index 35e29f6d7ad..3b0afba27e7 100644 --- a/cfgov/jobmanager/views.py +++ b/cfgov/jobmanager/views.py @@ -48,13 +48,12 @@ class RegionViewSet(SnippetViewSet): icon = "site" menu_label = "Regions" - def states_in_region(self): - return ", ".join(str(state) for state in self.states.all()) - - def major_cities(self): - return "; ".join(str(city) for city in self.major_cities.all()) - - list_display = ["abbreviation", "name", states_in_region, major_cities] + list_display = [ + "abbreviation", + "name", + "states_in_region", + "major_city_names", + ] class ServiceTypeViewSet(SnippetViewSet): diff --git a/cfgov/permissions_viewer/wagtail_hooks.py b/cfgov/permissions_viewer/wagtail_hooks.py index 1ce85491709..22c376526f1 100644 --- a/cfgov/permissions_viewer/wagtail_hooks.py +++ b/cfgov/permissions_viewer/wagtail_hooks.py @@ -36,7 +36,7 @@ def register_settings_menu_item(): @hooks.register("register_user_listing_buttons") -def user_listing_buttons(context, user): +def user_listing_buttons(user, request_user): yield UserListingButton( "View Permissions", reverse("permissions:user", args=[user.pk]), diff --git a/requirements/wagtail.txt b/requirements/wagtail.txt index 67706bddfba..da035c8fcac 100644 --- a/requirements/wagtail.txt +++ b/requirements/wagtail.txt @@ -1 +1 @@ -wagtail==6.0.5 +wagtail==6.1.3 diff --git a/test/cypress/integration/admin/admin-helpers.cy.js b/test/cypress/integration/admin/admin-helpers.cy.js index 35cb79ce770..72ff32c5f74 100644 --- a/test/cypress/integration/admin/admin-helpers.cy.js +++ b/test/cypress/integration/admin/admin-helpers.cy.js @@ -38,8 +38,8 @@ export class AdminPage { return cy.get('#listing-results').find('li'); } - tags() { - return cy.get('.tagfilter'); + filters() { + return cy.get('.w-filter-button'); } openDocumentsLibrary() { @@ -119,7 +119,7 @@ export class AdminPage { } cleanUpRegulations() { - cy.get('table tr').last().contains('Delete').click({ force: true }); + cy.get('table.listing tr').last().contains('Delete').click({ force: true }); this.submitForm(); } diff --git a/test/cypress/integration/admin/admin.cy.js b/test/cypress/integration/admin/admin.cy.js index 482d6f9861a..344325c13fb 100644 --- a/test/cypress/integration/admin/admin.cy.js +++ b/test/cypress/integration/admin/admin.cy.js @@ -19,7 +19,7 @@ describe('Admin', () => { it('should be able to open the Images library', () => { admin.openImageGallery(); admin.getImages().should('be.visible'); - admin.tags().should('be.visible'); + admin.filters().should('be.visible'); }); it('should be able to open the Documents library', () => {