Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 49 additions & 4 deletions app/eventyay/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
"""

import configparser
import importlib
import importlib_metadata
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

Both importlib_metadata (line 15) and importlib.metadata (imported via line 20: from importlib.metadata import entry_points) are being used. Since Python 3.8+, importlib.metadata is available in the standard library. The importlib_metadata backport is only needed for older Python versions. Consider using only importlib.metadata for consistency, or add a comment explaining why both are required if there's a specific compatibility reason.

Suggested change
import importlib_metadata

Copilot uses AI. Check for mistakes.
import importlib.util
import os
import sys
from collections import OrderedDict
from importlib.metadata import entry_points
from pathlib import Path
from urllib.parse import urlparse
Expand Down Expand Up @@ -208,10 +211,52 @@ def instance_name(request):
)
)

PLUGINS = []
for entry_point in entry_points(group='pretalx.plugin'):
PLUGINS.append(entry_point.module)
# INSTALLED_APPS += tuple(entry_point.module)
raw_exclude = config.get('eventyay', 'plugins_exclude', fallback='')
PLUGINS_EXCLUDE = [m.strip() for m in raw_exclude.split(',') if m.strip()]

eps = importlib_metadata.entry_points()

# Pretix plugins
pretix_plugins = [
ep.module
for ep in eps.select(group='pretix.plugin')
if ep.module not in PLUGINS_EXCLUDE
]

# Pretalx plugins
pretalx_plugins = [
ep.module
for ep in eps.select(group='pretalx.plugin')
if ep.module not in PLUGINS_EXCLUDE
]

ALL_PLUGINS = sorted(pretix_plugins + pretalx_plugins)


# ---------------------------
# TODO: Adjust import paths for pretix_venueless, pretix_downstream, pretalx_pages
# Once ready, remove below 2 lines of code and just add Pretix plugins to INSTALLED_APPS like:
# INSTALLED_APPS += tuple(pretix_plugins)
SAFE_PRETIX_PLUGINS = [
m for m in pretix_plugins if m not in {'pretix_venueless', 'pretix_pages'}
]
INSTALLED_APPS += tuple(SAFE_PRETIX_PLUGINS)

# ---------------------------
# TODO: Adjust import paths for pretalx_venueless, pretalx_downstream, pretalx_pages
# Once ready, uncomment the following line to add Pretalx plugins to INSTALLED_APPS
# INSTALLED_APPS += tuple(pretalx_plugins)

# Optional: Dynamic Import
LOADED_PLUGINS = OrderedDict()
for module_name in ALL_PLUGINS:
try:
module = importlib.import_module(module_name)
LOADED_PLUGINS[module_name] = module
except ModuleNotFoundError as e:
print(f"Plugin not found: {module_name} ({e})")
except ImportError as e:
print(f"Failed to import plugin {module_name}: {e}")

_LIBRARY_MIDDLEWARES = (
'corsheaders.middleware.CorsMiddleware',
Expand Down
42 changes: 42 additions & 0 deletions app/eventyay/control/forms/global_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,48 @@ def __init__(self, *args, **kwargs):
]
)

self.field_groups = [
('basics', _('Basics'), [
'footer_text', 'footer_link', 'banner_message', 'banner_message_detail',
]),
('localization', _('Localization'), [
'region',
]),
('email', _('Email'), [
'mail_from', 'email_vendor', 'send_grid_api_key',
'smtp_host', 'smtp_port', 'smtp_username', 'smtp_password',
'smtp_use_tls', 'smtp_use_ssl',
]),
('payment_gateways', _('Payment Gateways'), [
# PayPal
'payment_paypal_connect_client_id',
'payment_paypal_connect_secret_key',
'payment_paypal_connect_endpoint',

# Stripe
'payment_stripe_connect_client_id',
'payment_stripe_connect_secret_key',
'payment_stripe_connect_publishable_key',
'payment_stripe_connect_test_secret_key',
'payment_stripe_connect_test_publishable_key',
'payment_stripe_connect_app_fee_percent',
'payment_stripe_connect_app_fee_max',
'payment_stripe_connect_app_fee_min',

'payment_stripe_secret_key',
'payment_stripe_publishable_key',
'payment_stripe_test_secret_key',
'payment_stripe_test_publishable_key',
'stripe_webhook_secret_key',
]),
('ticket_fee', _('Ticket fee'), [
'ticket_fee_percentage',
]),
('maps', _('Maps'), [
'opencagedata_apikey', 'mapquest_apikey', 'leaflet_tiles', 'leaflet_tiles_attribution',
]),
]


class UpdateSettingsForm(SettingsForm):
update_check_perform = forms.BooleanField(
Expand Down
50 changes: 48 additions & 2 deletions app/eventyay/control/templates/pretixcontrol/global_settings.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "pretixcontrol/global_settings_base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load getitem %}
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

The template loads the getitem module but there are two separate files defining a getitem filter (getitem.py and hierarkey_form.py). Django's template loading may produce unpredictable results when multiple filters share the same name. The load statement should explicitly specify which module to use, or the duplicate filter definitions should be consolidated. Since hierarkey_form is loaded implicitly through template tag discovery, consider either removing the duplicate filter or using a unique name.

Suggested change
{% load getitem %}
{% load getitem from getitem %}

Copilot uses AI. Check for mistakes.
{% load static %}

{% block custom_header %}
Expand All @@ -11,10 +12,55 @@
<form action="" method="post" class="form-horizontal" enctype="multipart/form-data">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form layout='control' %}
<ul class="nav nav-tabs" role="tablist">
{% for group_key, group_label, field_names in form.field_groups %}
<li role="presentation" class="{% if forloop.first %}active{% endif %}">
<a href="#tab{{ forloop.counter }}" aria-controls="tab{{ forloop.counter }}" role="tab" data-toggle="tab">
{{ group_label }}
</a>
</li>
{% endfor %}
</ul>

<div class="tab-content">
{% for group_key, group_label, field_names in form.field_groups %}
<div role="tabpanel" class="tab-pane {% if forloop.first %}active{% endif %}" id="tab{{ forloop.counter }}">
{% if group_key == "payment_gateways" %}
<fieldset>
<legend>{% translate "Stripe" %}</legend>
{% for field_name in field_names %}
{% if "payment_stripe" in field_name or "stripe_webhook" in field_name %}
{% with form|getitem:field_name as field %}
{% bootstrap_field field layout='control' %}
{% endwith %}
{% endif %}
{% endfor %}
</fieldset>

<fieldset>
<legend>{% translate "PayPal" %}</legend>
{% for field_name in field_names %}
{% if "payment_paypal" in field_name %}
{% with form|getitem:field_name as field %}
{% bootstrap_field field layout='control' %}
{% endwith %}
{% endif %}
{% endfor %}
</fieldset>
{% else %}
{% for field_name in field_names %}
{% with form|getitem:field_name as field %}
{% bootstrap_field field layout='control' %}
{% endwith %}
{% endfor %}
{% endif %}
</div>
{% endfor %}
</div>

<div class="form-group submit-group">
<button type="submit" class="btn btn-primary btn-save">
{% trans "Save" %}
{% translate "Save" %}
</button>
</div>
</form>
Expand Down
4 changes: 2 additions & 2 deletions app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ dependencies = [
"elementpath>=4.7.0",
"emoji>=2.14.1",
"et-xmlfile>=2.0.0",
"eventyay-paypal @ git+https://github.com/fossasia/eventyay-tickets-paypal.git@4728e6733d971edb4db6df4ebfe12caefd371d55",
"eventyay-stripe @ git+https://github.com/fossasia/eventyay-tickets-stripe.git@1d461de9ac7ef743cb2e6ddbace3434ba5ec6fcc",
"eventyay-paypal @ git+https://github.com/fossasia/eventyay-tickets-paypal.git@1765e5b1aa31da570e16a09a076e96ab623436d1",
"eventyay-stripe @ git+https://github.com/fossasia/eventyay-tickets-stripe.git@a76e42f537666a19ac57072ffd32cd44353b8032",
"execnet>=2.1.1",
"faker>=37.3.0",
"fakeredis>=2.26.2",
Expand Down
8 changes: 4 additions & 4 deletions app/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.