Skip to content

Conversation

@AKRITI-ENG
Copy link
Contributor

@AKRITI-ENG AKRITI-ENG commented Dec 5, 2025

Fixes #1441

How I fixed it
Updated the template to use the correct URL pattern name that actually exists in the codebase:

  • Changed the URL from "control:event.item" to "control:event.product"
  • Updated the parameter from item=item.pk to product=item.pk to match what the URL expects

Testing done
I've tested this locally and confirmed:

  • The question delete page now loads without errors
  • Products linked to the question are displayed correctly with working links
  • The delete confirmation shows the proper warning message about lost answers
  • Both Cancel and Delete buttons work as expected

Before:
image

After:
image

Summary by Sourcery

Bug Fixes:

  • Correct the URL name and parameter in the question delete template so dependent product links resolve without NoReverseMatch errors.

Summary by Sourcery

Bug Fixes:

  • Correct the URL name and parameter in the question delete template so dependent product links point to the existing event product route.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 5, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR fixes a NoReverseMatch error on the question delete page by updating the template to use the correct event product URL name and parameter when rendering links to dependent products.

Sequence diagram for rendering question delete page with corrected product links

sequenceDiagram
    actor Admin
    participant Browser
    participant QuestionDeleteView
    participant DjangoTemplateEngine
    participant URLResolver

    Admin->>Browser: Request question delete page
    Browser->>QuestionDeleteView: HTTP GET /control/.../questions/<id>/delete
    QuestionDeleteView->>DjangoTemplateEngine: Render template question_delete.html with context
    loop For each item in dependent
        DjangoTemplateEngine->>URLResolver: reverse control:event.product(organizer, event, product=item.pk)
        URLResolver-->>DjangoTemplateEngine: Resolved product URL
    end
    DjangoTemplateEngine-->>QuestionDeleteView: HTML with product links
    QuestionDeleteView-->>Browser: HTTP 200 response
    Browser-->>Admin: Display delete confirmation with working product links
Loading

File-Level Changes

Change Details Files
Fix URL reversal for dependent product links in the question delete template to prevent NoReverseMatch and point to the correct view.
  • Update the {% url %} tag to use the existing "control:event.product" URL pattern instead of the non-existent "control:event.item"
  • Change the URL keyword argument from item=item.pk to product=item.pk to match the URL pattern signature while still iterating over dependent items
app/eventyay/control/templates/pretixcontrol/items/question_delete.html

Assessment against linked issues

Issue Objective Addressed Explanation
#1441 Fix the NoReverseMatch error when loading the delete confirmation page for questions that are linked to products, so the page renders successfully instead of showing an error.
#1441 Ensure the delete confirmation page for such questions displays the list of linked products with correct, working links to each product.
#1441 Maintain the expected delete confirmation UI (warning message about lost answers, and functional Cancel and Delete buttons) when deleting a question linked to products.

Possibly linked issues


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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

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

@AKRITI-ENG AKRITI-ENG marked this pull request as ready for review December 5, 2025 14:07
Copy link
Contributor

@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 there - I've reviewed your changes and they look great!


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
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a NoReverseMatch error in the question delete template by correcting the URL pattern reference for product links.

Key Changes:

  • Updated URL name from control:event.item to control:event.product
  • Changed URL parameter from item=item.pk to product=item.pk to match the correct URL pattern definition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mariobehling mariobehling requested a review from Sak1012 December 5, 2025 15:57
@mariobehling mariobehling merged commit 210b8bc into fossasia:enext Dec 8, 2025
1 of 2 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Eventyay Next Dec 8, 2025
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.

Error page when trying to delete a question tied to products

3 participants