Compare commits

..

No commits in common. "bcf7cce0cddc105548b03b1f3c66eec2a94c4110" and "1889e39b2068973591e6087d3d1b77ae1187afce" have entirely different histories.

6 changed files with 14 additions and 18 deletions

View File

@ -5,14 +5,6 @@ type: docker
name: default
steps:
- name: check style
image: python:3.12-alpine
commands:
- pip install black isort flake8
- black --check .
- isort -c .
- flake8 .
- name: build
image: python:3.12-alpine
commands:
@ -35,9 +27,3 @@ steps:
when:
event:
- tag
trigger:
event:
- pr
- push
- tag

View File

@ -1,14 +1,17 @@
from i18nfield.forms import I18nModelForm
from .models import MusicrateSettings
class MusicrateSettingsForm(I18nModelForm):
def __init__(self, *args, event=None, **kwargs):
self.instance, _ = MusicrateSettings.objects.get_or_create(event=event)
super().__init__(*args, **kwargs, instance=self.instance, locales=event.locales)
class Meta:
model = MusicrateSettings
fields = ("some_setting",)
fields = ("some_setting", )
widgets = {}

View File

@ -1,6 +1,8 @@
from django.db import models
class MusicrateSettings(models.Model):
event = models.OneToOneField(
to="event.Event",
@ -8,3 +10,4 @@ class MusicrateSettings(models.Model):
related_name="pretalx_musicrate_settings",
)
some_setting = models.CharField(max_length=10, default="A")

View File

@ -1,3 +1,4 @@
from django.dispatch import receiver
from django.urls import reverse
from pretalx.orga.signals import nav_event_settings
@ -18,3 +19,4 @@ def pretalx_musicrate_settings(sender, request, **kwargs):
== "plugins:pretalx_musicrate:settings",
}
]

View File

@ -1,3 +1,4 @@
from django.urls import re_path
from pretalx.event.models.event import SLUG_REGEX
@ -10,3 +11,4 @@ urlpatterns = [
name="settings",
),
]

View File

@ -3,6 +3,7 @@ from django.utils.translation import gettext_lazy as _
from django.views.generic import FormView
from pretalx.common.mixins.views import PermissionRequired
from .forms import MusicrateSettingsForm
@ -24,7 +25,6 @@ class MusicrateSettingsView(PermissionRequired, FormView):
def form_valid(self, form):
form.save()
messages.success(
self.request, _("The pretalx musicrate plugin settings were updated.")
)
messages.success(self.request, _("The pretalx musicrate plugin settings were updated."))
return super().form_valid(form)