Skip to content

Centralize event settings in eventyay-common #716

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

Open
wants to merge 9 commits into
base: development
Choose a base branch
from

Conversation

SxxAq
Copy link
Contributor

@SxxAq SxxAq commented Jun 2, 2025

ref: #699

This PR centralizes general event settings by ensuring they are managed and displayed primarily through the eventyay_common component's settings page. It moves the management of certain event settings (like contact_mail, imprint_url, region) to EventCommonSettingsForm and cleans up the Tickets component's general settings form (EventSettingsForm) to avoid duplication.

250603_01h53m44s_screenshot
screencapture-app-eventyay-tickets-common-event-shxdow-rq7gj-settings-2025-06-03-01_53_25
screencapture-app-eventyay-tickets-common-event-shxdow-rq7gj-settings-2025-06-03-02_07_58

Copy link
Contributor

sourcery-ai bot commented Jun 2, 2025

Reviewer's Guide

This PR consolidates general event settings into the eventyay_common component by migrating fields from the Tickets component’s EventSettingsForm to EventCommonSettingsForm, cleaning up duplicate form fields in templates, and improving form safety and error handling.

Sequence Diagram: Saving Event Settings via eventyay_common

sequenceDiagram
    title Sequence Diagram: Saving Centralized Event Settings
    actor User
    participant Browser
    participant WebServer
    participant EventyayCommonView as "eventyay_common.EventSettingsView"
    participant EventCommonSettingsForm as "forms.EventCommonSettingsForm"
    participant SettingsDB as "Settings Database"

    User->>Browser: Modifies settings (e.g., contact_mail, region) and clicks Save
    Browser->>WebServer: POST /event/settings (eventyay_common path)
    WebServer->>EventyayCommonView: handle_post_request(request)
    EventyayCommonView->>EventCommonSettingsForm: __init__(data=request.POST, instance=event_settings)
    EventyayCommonView->>EventCommonSettingsForm: is_valid()
    alt Form is valid
        EventCommonSettingsForm->>EventyayCommonView: True
        EventyayCommonView->>EventCommonSettingsForm: save()
        EventCommonSettingsForm->>SettingsDB: UPDATE event_settings SET contact_mail, region, etc.
        SettingsDB-->>EventCommonSettingsForm: Success
        EventCommonSettingsForm-->>EventyayCommonView: Saved settings object
        EventyayCommonView-->>Browser: HTTP 302 Redirect / Success Page
        Browser-->>User: Displays success message / updated settings
    else Form is invalid
        EventCommonSettingsForm->>EventyayCommonView: False (with errors)
        EventyayCommonView-->>Browser: HTTP 200 Render form with errors
        Browser-->>User: Displays form with error messages
    end
Loading

Class Diagram: Updates to Event Settings Forms

classDiagram
    title Class Diagram: Changes to Event Settings Forms
    class EventSettingsForm {
        -timezone : ChoiceField (removed)
        -imprint_url (removed from auto_fields)
        -locales (removed from auto_fields)
        -locale (removed from auto_fields)
        -region (removed from auto_fields)
        -contact_mail (removed from auto_fields)
        +name_scheme : ChoiceField
        +checkout_email_helptext : String
        +presale_has_ended_text : String
        +show_items_outside_presale_period : Boolean
        +display_net_prices : Boolean
        +presale_start_show_date : Boolean
        +show_quota_left : Boolean
        +waiting_list_enabled : Boolean
        +max_items_per_order : Integer
        +reservation_time : Integer
        +show_variations_expanded : Boolean
        +hide_sold_out : Boolean
        +meta_noindex : Boolean
        # ... (other remaining fields and methods)
    }

    class EventCommonSettingsForm {
        +locales : List (existing)
        +locale : String (existing)
        +region : String (added to auto_fields)
        +contact_mail : String (added to auto_fields)
        +imprint_url : String (added to auto_fields)
        +timezone : ChoiceField (added)
        # ... (other existing fields and methods)
    }
Loading

File-Level Changes

Change Details Files
Migrate general settings fields from EventSettingsForm to EventCommonSettingsForm
  • Removed contact_mail, imprint_url, region, locales, locale, timezone from EventSettingsForm auto_fields
  • Added region, contact_mail, imprint_url to EventCommonSettingsForm auto_fields
  • Updated clean() in EventCommonSettingsForm
src/pretix/control/forms/event.py
src/pretix/eventyay_common/forms/event.py
Improve safety in field deletion and initial value lookup in EventSettingsForm
  • Wrapped del self.fields calls in if-checks
  • Replaced self.initial[...] with self.initial.get(...) for safe access
src/pretix/control/forms/event.py
Clean up pretix control event settings template to remove duplicates
  • Removed bootstrap_field entries for contact_mail, imprint_url, localization fields
  • Added rendering of sform errors
  • Removed entire Localization fieldset
src/pretix/control/templates/pretixcontrol/event/settings.html
Enhance eventyay_common settings template with migrated fields and error handling
  • Added bootstrap_form_errors for sform
  • Added fields contact_mail, imprint_url, region alongside existing locale/timezone
  • Rearranged and inserted new form fields for consistency
src/pretix/eventyay_common/templates/eventyay_common/event/settings.html

Possibly linked issues

  • #1: The PR implements the issue's goal of centralizing event settings by moving fields like location, contact mail, imprint URL, and region from eventyay-tickets to eventyay-common.

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

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: 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.

@mariobehling mariobehling changed the title Enh/shop design Centralize event settings in eventyay-common Jun 4, 2025
@hpdang
Copy link
Member

hpdang commented Jun 4, 2025

@SxxAq thank you for the PR. It works :) however could you please 1) move "Show in List" and "Restrict to specific sales chanels" below the Imprint? and 2) resolve the conflicts here

Screenshot from 2025-06-04 20-39-36

Copy link
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

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

@SxxAq Correction of @hpdang

  1. Please move Show in lists below "imprint"
  2. Only show "Restrict to channels" on eventyay-tickets settings.

@SxxAq
Copy link
Contributor Author

SxxAq commented Jun 5, 2025

@mariobehling show in list moved below imprint URL as requested also restrict to channels removed from common settings which is now only accessible through ticket settings.
image

Copy link
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

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

Ok, thanks!

@mariobehling mariobehling requested a review from hongquan June 6, 2025 10:34
Copy link
Member

@norbusan norbusan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@Gagan-Ram Gagan-Ram left a comment

Choose a reason for hiding this comment

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

  1. The UI looks clean. However, for the Geo-coordinates section, please revert to the previous layout where latitude and longitude are displayed on the same line.

  2. When I attempt to modify or add new data in any field within the entire Settings menu of eventyay-common or in Settings > General of eventyay-tickets, the changes are not being saved. Instead, I receive a form error stating, "We could not save your changes. See below for details."

@mariobehling
Copy link
Member

@SxxAq Please follow up on this when available:

please revert to the previous layout where latitude and longitude are displayed on the same line.

@SxxAq
Copy link
Contributor Author

SxxAq commented Jun 19, 2025

@mariobehling the issue related to changes not being saved is resolved now. also geo-lat changed to previous layout.

2025-06-19.21-11-33.mp4

Copy link
Member

@Gagan-Ram Gagan-Ram left a comment

Choose a reason for hiding this comment

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

716_pr_error.webm
@SxxAq Could you clarify why I am facing this issue?

@SxxAq
Copy link
Contributor Author

SxxAq commented Jun 20, 2025

716_pr_error.webm @SxxAq Could you clarify why I am facing this issue?

this is the default behaviour as of now and the reason is below. its for autocompletion i think. it is making a backend request with the provided string to fetch location suggestions but the url is not being resolved. but the location can be saved after closing the error message.

@mariobehling please have a look. i think this should need a separate issue.
image

@mariobehling
Copy link
Member

@SxxAq Thanks for pointing this out. Could you help please to remove autocompletion? Will that be sufficient to avoid this? Thank you!

@SxxAq SxxAq requested a review from hongquan June 20, 2025 18:24
@SxxAq
Copy link
Contributor Author

SxxAq commented Jun 20, 2025

@SxxAq Thanks for pointing this out. Could you help please to remove autocompletion? Will that be sufficient to avoid this? Thank you!

Fixed. I commented out the particular geo.js file which was making the AJAX request. commented out instead of deleting incase it can be fixed later.

@SxxAq SxxAq force-pushed the enh/shop_design branch from da4de87 to bbe2c43 Compare June 28, 2025 16:24
@SxxAq SxxAq requested a review from mariobehling June 28, 2025 16:26
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.

7 participants