Skip to content
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

Refactor redirects edit view to CBV #11860

Merged
merged 4 commits into from Apr 29, 2024

Conversation

rohitsrma
Copy link
Contributor

In this PR I've converted redirects edit view from FBV to CBV as a part of #8365 .

Copy link

squash-labs bot commented Apr 17, 2024

Manage this branch in Squash

Test this branch here: https://rohitsrmarefactor-redirects-ed-k370b.squash.io

@laymonage laymonage added this to the 6.2 milestone Apr 23, 2024
@laymonage laymonage self-assigned this Apr 23, 2024
Copy link
Member

@laymonage laymonage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is a good start, but there are a few things missing and some that could be improved. Some of them are things we've discussed before, so I highly suggest re-reviewing your previous PRs to avoid the same mistakes – which can help us move faster 😄

wagtail/contrib/redirects/views.py Outdated Show resolved Hide resolved
wagtail/contrib/redirects/views.py Outdated Show resolved Hide resolved
wagtail/contrib/redirects/views.py Outdated Show resolved Hide resolved
wagtail/contrib/redirects/views.py Outdated Show resolved Hide resolved
wagtail/contrib/redirects/views.py Outdated Show resolved Hide resolved
wagtail/contrib/redirects/tests/test_redirects.py Outdated Show resolved Hide resolved
wagtail/contrib/redirects/views.py Show resolved Hide resolved
wagtail/contrib/redirects/views.py Show resolved Hide resolved
@rohitsrma
Copy link
Contributor Author

Thanks @laymonage, I've made the changes. And, I'm really sorry for making the same mistakes again. I'll make sure not to do them again in the future.

Copy link
Member

@laymonage laymonage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small thing remaining (enabling breadcrumbs), but otherwise this looks good to me! I'll add the breadcrumbs myself and merge. Thanks, and sorry if my previous comment was a bit harsh!

delete_url_name = "wagtailredirects:delete"
pk_url_kwarg = "redirect_id"
permission_policy = permission_policy
error_message = gettext_lazy("The redirect could not be saved due to errors.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can now show the breadcrumbs

Suggested change
error_message = gettext_lazy("The redirect could not be saved due to errors.")
error_message = gettext_lazy("The redirect could not be saved due to errors.")
header_icon = "redirect"
_show_breadcrumbs = True

@laymonage laymonage force-pushed the refactor-redirects-edit-view branch from cfcc99f to 4302bed Compare April 29, 2024 07:42
Copy link
Member

@laymonage laymonage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks like this also resolves an issue where the error message for duplicate redirects is rendered awkwardly on the page, so that's great!

Before

image

After

image

Note: this issue still exists in the create view though, but that's a separate task.

@laymonage laymonage merged commit 4302bed into wagtail:main Apr 29, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants