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

fix: forms did not redirect to same page if sent from alias #20

Merged
merged 8 commits into from
Jan 7, 2025

Conversation

fsbraun
Copy link
Member

@fsbraun fsbraun commented Jan 7, 2025

Summary by Sourcery

Fix form redirection issue when submitted from an alias and update framework support to include newer versions of Django and Django CMS. Update CI configuration to test against these newer versions.

Bug Fixes:

  • Fix forms to redirect to the same page when submitted from an alias by updating the redirect logic.

Enhancements:

  • Update Django and Django CMS framework classifiers to include newer versions.

CI:

  • Update CI workflow to test against newer Django and Django CMS versions.

Copy link

sourcery-ai bot commented Jan 7, 2025

Reviewer's Guide by Sourcery

This pull request fixes a bug where forms did not redirect to the same page when submitted from an alias. The fix involves updating the redirect behavior to explicitly redirect to the same page using the SAME_PAGE_REDIRECT constant. Additionally, Django and Django CMS dependencies are updated to include support for newer versions.

Sequence diagram for form submission and redirection flow

sequenceDiagram
    participant User as User
    participant Form as Form Plugin
    participant Server as Server

User->>Form: Submits form
Form->>Server: POST request
Note over Server: Process form data
Server-->>User: Redirect to SAME_PAGE_REDIRECT
Note over User: User stays on same page
Note right of Server: Previously redirected to
Note right of Server: placeholder.page which
Note right of Server: didn't work with aliases
Loading

Class diagram showing CMSAjaxBase plugin changes

classDiagram
    class CMSAjaxBase {
        +ajax_post(request, instance, parameter)
        +get_form_class()
        +get_form_fields()
    }

    class FormPlugin {
        +form_spacing
        +form_login_required
        +form_unique
        +form_actions
        +get_form_fields()
    }

    FormPlugin --|> CMSAjaxBase

    note for FormPlugin "Changed redirect behavior
from placeholder.page to
SAME_PAGE_REDIRECT"
Loading

File-Level Changes

Change Details Files
Updated redirect behavior to use SAME_PAGE_REDIRECT constant
  • Set the redirect option in meta_options to SAME_PAGE_REDIRECT to ensure redirection to the current page after form submission.
djangocms_form_builder/cms_plugins/ajax_plugins.py
Updated Django and Django CMS dependencies
  • Added support for Django 5.0, 5.1, and Django CMS 3.9.
  • Removed support for Django 2.2, 3.2, and Django CMS 3.8.
pyproject.toml
Updated CI workflow
  • Added support for Django 5.1 and Django CMS 4.1 in the CI workflow.
  • Removed support for Django 3.2 and Django CMS 3.10 in the CI workflow.
.github/workflows/codecov.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @fsbraun - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a comment explaining why SAME_PAGE_REDIRECT is needed instead of placeholder.page, particularly in relation to form submissions from alias pages.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

codecov bot commented Jan 7, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@fsbraun fsbraun merged commit 3bd0066 into main Jan 7, 2025
37 checks passed
@fsbraun fsbraun deleted the fix/same-page-redirect branch January 7, 2025 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant