Skip to content

Conversation

Sana0523
Copy link
Contributor

@Sana0523 Sana0523 commented Jun 28, 2025

@mariobehling
Implemented additional options and features for vouchers as per requirement.

image
image
image

Issue fix: #676

If you encounter an Internal Server Error due to model migrations, please run:

docker exec -it eventyay-ticket python pretix/src/manage.py makemigrations pretixbase
docker exec -it eventyay-ticket python pretix/src/manage.py migrate

Summary by Sourcery

Introduce new voucher options and features including minimum usage limits, free add-ons, bundled item inclusion, exhibitor association, and exhibitor comments; update forms, detail view, and listing templates to surface these fields.

New Features:

  • Add minimum usages limit for vouchers
  • Add free add-ons option for vouchers
  • Add include bundled items flag for vouchers
  • Allow associating an exhibitor and comment with a voucher

Enhancements:

  • Expose new voucher fields in the listing table
  • Update voucher creation and detail forms to include new options

Copy link
Contributor

sourcery-ai bot commented Jun 28, 2025

Reviewer's Guide

This PR adds new voucher configuration options—minimum usages, free add‐ons, bundled inclusion—and supports assigning vouchers to exhibitors with comments, updating both the backend form definitions and the UI templates to reflect and manage these options.

Class diagram for updated Voucher form fields

classDiagram
    class VoucherForm {
        +minimum_usages: Integer
        +free_addons: Boolean
        +include_bundled: Boolean
        +exhibitor: String
        +exhibitor_comment: String
    }
Loading

File-Level Changes

Change Details Files
Extended the vouchers list view to display new voucher attributes.
  • Added table header columns for minimum usages, free add‐ons, bundled inclusion, and exhibitor
  • Rendered voucher.minimum_usages in its own cell
  • Displayed free_addons and include_bundled as yes/no labels
  • Shown exhibitor name with optional comment in a nested small text
src/pretix/control/templates/pretixcontrol/vouchers/index.html
Updated the VoucherForm to include the new fields in its Meta definition.
  • Inserted minimum_usages, free_addons, include_bundled, exhibitor, and exhibitor_comment into the fields list
  • Ensured these new fields are included in both form definitions
src/pretix/control/forms/vouchers.py
Enhanced the voucher detail template to expose new settings and exhibitor assignment.
  • Added bootstrap fields for minimum_usages, free_addons, and include_bundled under Advanced settings
  • Created a new Exhibitor fieldset with exhibitor and exhibitor_comment inputs
src/pretix/control/templates/pretixcontrol/vouchers/detail.html

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

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 @Sana0523 - I've reviewed your changes - here's some feedback:

  • Please include the generated migration file for these new voucher fields in the PR instead of asking users to run makemigrations manually.
  • Add a min_value validator (and possibly help_text) to the minimum_usages field to prevent negative values and improve UX.
  • Consider renaming or adding help_text to the “Include bundled” label so it’s clear which bundled items are being included.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Please include the generated migration file for these new voucher fields in the PR instead of asking users to run makemigrations manually.
- Add a min_value validator (and possibly help_text) to the minimum_usages field to prevent negative values and improve UX.
- Consider renaming or adding help_text to the “Include bundled” label so it’s clear which bundled items are being included.

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.

@mariobehling
Copy link
Member

@Sana0523 Thanks, we will review it. Could you please use a full screen capture tool, e.g. a Chrome plugin in future. This way it will be easier to see the whole page. Thank you!

Copy link
Contributor

@Saksham-Sirohi Saksham-Sirohi left a comment

Choose a reason for hiding this comment

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

These changes appear not to be working, even after trying the migrate command. I still see an internal server error

@Sana0523
Copy link
Contributor Author


These changes appear not to be working, even after trying the migrate command. I still see an internal server error

@Saksham-Sirohi I'll look into the error from my end and get back.
Thank you.

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.

Implement Additional Options for Vouchers
3 participants