Skip to content

Conversation

Gagan-Ram
Copy link
Member

@Gagan-Ram Gagan-Ram commented Jul 16, 2025

#479

global_admin_design.webm

Summary by Sourcery

Introduce a tabbed layout for global admin settings by grouping fields into logical sections and updating the template to render Bootstrap tabs with separate Stripe and PayPal fieldsets

Enhancements:

  • Add field_groups attribute to settings form to organize fields into Basics, Localization, Email, Payment Gateways, Ticket Fee, and Maps sections
  • Refactor global_settings template to display fields in Bootstrap nav-tabs with dedicated Stripe and PayPal fieldsets under Payment Gateways
  • Implement get_item template filter to facilitate dynamic access to form fields in templates

Copy link
Contributor

sourcery-ai bot commented Jul 16, 2025

Reviewer's Guide

This PR refactors the global admin settings UI by introducing a field_groups structure in the form for logical grouping and updating the template to render these groups as Bootstrap tabs and sections, with special handling for payment gateways. It also adds a helper template filter to access form fields dynamically.

Class diagram for UpdateSettingsForm and field_groups addition

classDiagram
    class GlobalSettingsForm {
        +field_groups: list
        __init__(...)
    }
    class UpdateSettingsForm
    GlobalSettingsForm <|-- UpdateSettingsForm
Loading

File-Level Changes

Change Details Files
Introduce field_groups grouping in GlobalSettingsForm
  • Define field_groups as a list of (label, field name list) tuples
  • Group settings into Basics, Localization, Email, Payment Gateways, Ticket Fee, and Maps
  • Include new stripe_webhook_secret_key in the Payment Gateways group
src/pretix/control/forms/global_settings.py
Redesign global_settings.html to render tabs and grouped fields
  • Load getitem filter and replace bootstrap_form with manual nav tabs
  • Iterate form.field_groups to generate tab headers and content panes
  • Use separate Stripe and PayPal fieldsets within the Payment Gateways tab
  • Render each field with bootstrap_field layout and update save button tag
src/pretix/control/templates/pretixcontrol/global_settings.html
Add get_item template filter for dynamic field lookup
  • Register get_item filter returning dictionary.get(key)
src/pretix/control/templatetags/hierarkey_form.py

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 @Gagan-Ram - 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.

@Gagan-Ram
Copy link
Member Author

@hongquan Some Payment Gateways fields are just rendered as a form field. e.g. the ones which are commented as 'used only in signals'. I wonder what are they really used for, as I could not see any python files using its values.
Also some fields serve same purpose (e.g. payment_stripe_connect_secret_key and payment_stripe_secret_key,
payment_stripe_connect_test_publishable_key and payment_stripe_test_publishable_key etc).
Could you please help me in retaining only necessary fields here.
Thank you.

@mariobehling
Copy link
Member

The Stripe setup is a bit complicated and maybe confusing:

  1. We are using Stripe to let organisers pay for their event. This feature is included in the platform and we have Stripe fields to enter this data always.
  2. We are using Stripe to process payments of attendees. We also need to enter Stripe information into Global Settings related to platform processing of those payments.
    Therefore we need to ensure that all payment options continue to work when moving these fields. In the previous implementation this was an issue.

The same applies to the Paypal plugin. We need to ensure the plugin fields continue to appear in the Global Settings.

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.

2 participants