Skip to content

Conversation

@taanvi2205
Copy link

@taanvi2205 taanvi2205 commented Nov 11, 2025

Remove unstable component selection and ensure initial event data setup (closes #1154)

Summary

This PR removes the unstable component selection UI (Tickets, Talk, Video) from the “Create Event” page and ensures all three components are initialized automatically when a new event is created.

Changes

  • Commented out “Create this event for” section in
    eventyay/eventyay_common/templates/eventyay_common/events/create_foundation.html
  • Ensured backend event initialization logic (talk/src/pretalx/event/models/event.py) builds all default components on event creation.

Expected Behavior

  • “Create this event for” section and related toggles are no longer visible.
  • Event creation automatically sets up Tickets, Talk, and Video.
  • No component-related warnings or errors occur.

Screenshots

Before:
Screenshot 2025-11-11 at 10 31 09 PM

After:
Screenshot 2025-11-11 at 9 53 24 PM
Screenshot 2025-11-11 at 9 54 10 PM

TODO (Future)

  • Reintroduce component selection once unified component setup is stable.
  • Re-enable event series after unified scheduling logic testing.

(closes #1154)

Summary by Sourcery

Remove the component-selection toggles from the event creation template and ensure all event components (Tickets, Talk, Video) are initialized by default during event setup.

Bug Fixes:

  • Automatically initialize the Tickets component on event creation to prevent missing component errors.

Enhancements:

  • Remove the unstable component-selection UI section from the Create Event page.
  • Update build_initial_data to auto-create default ticket items alongside Talk and Video components.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 11, 2025

Reviewer's Guide

Removes unstable component-selection UI from the “Create Event” page and enhances the build_initial_data method to automatically initialize the Tickets component alongside existing CfP, schedules, mail templates, review phases, and score categories.

Class diagram for updated Event initialization logic

classDiagram
    class Event {
        +build_initial_data()
        cfp
        schedules
        items
        score_categories
    }
    class CfP {
        event
        default_type
    }
    class Schedule {
        event
    }
    class ItemCategory {
        event
        name
    }
    class Item {
        event
        name
        default_price
        category
    }
    class ReviewScoreCategory {
        event
        name
    }
    class ReviewScore {
        category
        value
        label
    }
    Event --> CfP
    Event --> Schedule
    Event --> ItemCategory
    ItemCategory --> Item
    Event --> ReviewScoreCategory
    ReviewScoreCategory --> ReviewScore
Loading

File-Level Changes

Change Details Files
Removed unstable component-selection UI from the “Create Event” page
  • Commented out the “Create this event for” section and related toggles
  • Retained only essential form fields (organizer, event type, locales)
  • Inserted TODO comments for future reintroduction of selection logic
app/eventyay/eventyay_common/templates/eventyay_common/events/create_foundation.html
Enhanced backend event initialization to auto-setup Tickets component
  • Imported pretix.presale models for Item and ItemCategory
  • Added logic to create a default Tickets category and Item when none exist
  • Streamlined ReviewScore creation calls for score categories
talk/src/pretalx/event/models/event.py

Assessment against linked issues

Issue Objective Addressed Explanation
#1154 Remove the component selection options (Tickets, Talk, Video) from the 'Create Event' page UI and logic, and ensure all three components are created automatically when a new event is created.
#1154 Comment out or hide the 'Event series or time slot booking' option in the UI and skip all related form inputs and backend calls, with a TODO for future reactivation.
#1154 Ensure backend logic supports initializing all components (Tickets, Talk, Video) by default when an event is created.

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

  • The create_foundation.html template is cluttered with large commented-out sections; consider removing dead code or wrapping it behind a feature flag for better maintainability.
  • In build_initial_data, use get_or_create for ItemCategory and Item instead of always create to make initialization idempotent and avoid IntegrityErrors on reruns.
  • Ensure the automatic ticket setup covers any additional Pretix requirements (like quotas or tax rules) so no essential configurations are missing post-creation.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The create_foundation.html template is cluttered with large commented-out sections; consider removing dead code or wrapping it behind a feature flag for better maintainability.
- In build_initial_data, use get_or_create for ItemCategory and Item instead of always create to make initialization idempotent and avoid IntegrityErrors on reruns.
- Ensure the automatic ticket setup covers any additional Pretix requirements (like quotas or tax rules) so no essential configurations are missing post-creation.

## Individual Comments

### Comment 1
<location> `talk/src/pretalx/event/models/event.py:647-657` </location>
<code_context>

+        # --- New Section: Initialize Tickets system automatically ---
+        from pretix.presale.models import Item, ItemCategory  # adjust import if needed
+        if not self.items.exists():
+            category = ItemCategory.objects.create(event=self, name=_("Tickets"))
+            Item.objects.create(
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Check for existing ticket categories/items with more granularity.

Currently, the check does not differentiate between ticket and non-ticket items, which may result in duplicate ticket categories. Please update the logic to specifically check for an existing 'Tickets' category or 'General Admission' item.

```suggestion
        # --- New Section: Initialize Tickets system automatically ---
        from pretix.presale.models import Item, ItemCategory  # adjust import if needed

        # Check for existing 'Tickets' category
        tickets_category = ItemCategory.objects.filter(event=self, name=_("Tickets")).first()
        if not tickets_category:
            tickets_category = ItemCategory.objects.create(event=self, name=_("Tickets"))

        # Check for existing 'General Admission' item in the 'Tickets' category
        general_admission_item = Item.objects.filter(
            event=self,
            name=_("General Admission"),
            category=tickets_category
        ).first()

        if not general_admission_item:
            Item.objects.create(
                event=self,
                name=_("General Admission"),
                default_price=0,
                category=tickets_category,
            )
        # ------------------------------------------------------------
```
</issue_to_address>

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.

Comment on lines +647 to +657
# --- New Section: Initialize Tickets system automatically ---
from pretix.presale.models import Item, ItemCategory # adjust import if needed
if not self.items.exists():
category = ItemCategory.objects.create(event=self, name=_("Tickets"))
Item.objects.create(
event=self,
name=_("General Admission"),
default_price=0,
category=category,
)
# ------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (bug_risk): Check for existing ticket categories/items with more granularity.

Currently, the check does not differentiate between ticket and non-ticket items, which may result in duplicate ticket categories. Please update the logic to specifically check for an existing 'Tickets' category or 'General Admission' item.

Suggested change
# --- New Section: Initialize Tickets system automatically ---
from pretix.presale.models import Item, ItemCategory # adjust import if needed
if not self.items.exists():
category = ItemCategory.objects.create(event=self, name=_("Tickets"))
Item.objects.create(
event=self,
name=_("General Admission"),
default_price=0,
category=category,
)
# ------------------------------------------------------------
# --- New Section: Initialize Tickets system automatically ---
from pretix.presale.models import Item, ItemCategory # adjust import if needed
# Check for existing 'Tickets' category
tickets_category = ItemCategory.objects.filter(event=self, name=_("Tickets")).first()
if not tickets_category:
tickets_category = ItemCategory.objects.create(event=self, name=_("Tickets"))
# Check for existing 'General Admission' item in the 'Tickets' category
general_admission_item = Item.objects.filter(
event=self,
name=_("General Admission"),
category=tickets_category
).first()
if not general_admission_item:
Item.objects.create(
event=self,
name=_("General Admission"),
default_price=0,
category=tickets_category,
)
# ------------------------------------------------------------

@hongquan
Copy link
Member

Please use a descriptive title for the PR.
Reading "fix:closes #1154", people don't understand what this PR does.

@mariobehling mariobehling changed the title fix:closes #1154 fix (cleanup): simplifies “Create Event” page and remove unstable options Nov 20, 2025
@mariobehling mariobehling requested a review from Copilot November 20, 2025 02:22
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 simplifies the "Create Event" page by removing unstable component-selection UI elements and ensures automatic initialization of event components (Tickets, Talk, and Video) during event creation.

  • Removed "Create this event for" section with Tickets/Talk/Video toggles from the event creation template
  • Attempted to add automatic ticket system initialization in the backend
  • Commented out "Event series or time slot booking" option to prevent scheduling sync issues

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
talk/src/pretalx/event/models/event.py Added automatic ticket initialization logic and commented out old build_initial_data method; however, contains critical import and model reference errors
app/eventyay/eventyay_common/templates/eventyay_common/events/create_foundation.html Commented out component selection UI and event series option with malformed comment syntax

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

Comment on lines +93 to +114
<!-- {# -->
<div class="big-radio radio">
<label>
<input type="radio" value="on" name="{{ form.has_subevents.html_name }}" {% if form.has_subevents.avalue %}checked{% endif %}>
<span class="fa fa-calendar"></span>
<strong>{% trans "Event series or time slot booking" %}</strong>
<div class="help-block">
{% blocktrans trimmed %}
A series of events that share the same configuration. They can still be different in
their dates, locations, prices, and capacities.
{% endblocktrans %}
</div>
<div class="help-block">
{% blocktrans trimmed %}
Examples: Multiple presentations of the same show, same concert in multiple locations,
museums, libraries, or swimming pools,
events that need to be booked together in one cart.
{% endblocktrans %}
</div>
</label>
</div>
{% bootstrap_field form.locales layout="horizontal" %}
{% endblock %}
<!-- #} -->
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

The HTML comment syntax appears to be malformed. The opening is <!-- {# but the closing is <!-- #} -->, mixing HTML comments with Django template comments. This should either be:

  • Pure HTML comments: <!-- ... -->
  • Or pure Django template comments: {# ... #}

The current mixed syntax may cause template parsing issues or unexpected rendering behavior.

Copilot uses AI. Check for mistakes.
<!-- {# -->
<div class="big-radio radio">
<label>
<input type="radio" value="on" name="{{ form.has_subevents.html_name }}" {% if form.has_subevents.avalue %}checked{% endif %}>
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

There's a typo in the template condition: avalue should be value. The correct attribute to check the value of a form field is value, not avalue.

Suggested change
<input type="radio" value="on" name="{{ form.has_subevents.html_name }}" {% if form.has_subevents.avalue %}checked{% endif %}>
<input type="radio" value="on" name="{{ form.has_subevents.html_name }}" {% if form.has_subevents.value %}checked{% endif %}>

Copilot uses AI. Check for mistakes.
Comment on lines +611 to +630
# name=str(_("Score")),
# )
# ReviewScore.objects.create(
# category=category,
# value=0,
# label=str(_("No")),
# )
# ReviewScore.objects.create(
# category=category,
# value=1,
# label=str(_("Maybe")),
# )
# ReviewScore.objects.create(
# category=category,
# value=2,
# label=str(_("Yes")),
# )
# self.save()

# build_initial_data.alters_data = True
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

[nitpick] Large block of commented-out code (66 lines) should be removed rather than left in the codebase. Since this is intentionally being removed as per the PR description ("Remove unstable component selection"), the commented code should be deleted entirely. If the code needs to be preserved for future reference, it can be retrieved from version control history.

Keeping large blocks of commented code reduces code readability and maintainability.

Suggested change
# name=str(_("Score")),
# )
# ReviewScore.objects.create(
# category=category,
# value=0,
# label=str(_("No")),
# )
# ReviewScore.objects.create(
# category=category,
# value=1,
# label=str(_("Maybe")),
# )
# ReviewScore.objects.create(
# category=category,
# value=2,
# label=str(_("Yes")),
# )
# self.save()
# build_initial_data.alters_data = True

Copilot uses AI. Check for mistakes.
Comment on lines +648 to +656
from pretix.presale.models import Item, ItemCategory # adjust import if needed
if not self.items.exists():
category = ItemCategory.objects.create(event=self, name=_("Tickets"))
Item.objects.create(
event=self,
name=_("General Admission"),
default_price=0,
category=category,
)
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

The import statement from pretix.presale.models import Item, ItemCategory appears to be incorrect for this codebase. The pretalx Event model (in talk/src/pretalx/event/models/event.py) does not have an items field or relationship, and the pretix.presale module is part of a different application (eventyay/pretix, not pretalx/talk).

This code will likely fail at runtime when self.items.exists() is called, as the Event model doesn't have this attribute. Consider using the correct models and relationships from the pretalx/eventyay architecture, or remove this section if ticket initialization should be handled elsewhere.

Suggested change
from pretix.presale.models import Item, ItemCategory # adjust import if needed
if not self.items.exists():
category = ItemCategory.objects.create(event=self, name=_("Tickets"))
Item.objects.create(
event=self,
name=_("General Admission"),
default_price=0,
category=category,
)

Copilot uses AI. Check for mistakes.
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.

Cleanup: Simplify “Create Event” Page and Remove Unstable Options

3 participants