Compare commits
2 Commits
1889e39b20
...
bcf7cce0cd
Author | SHA1 | Date |
---|---|---|
Luca | bcf7cce0cd | |
Luca | 6b25989d27 |
14
.drone.yml
14
.drone.yml
|
@ -5,6 +5,14 @@ type: docker
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: check style
|
||||||
|
image: python:3.12-alpine
|
||||||
|
commands:
|
||||||
|
- pip install black isort flake8
|
||||||
|
- black --check .
|
||||||
|
- isort -c .
|
||||||
|
- flake8 .
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
image: python:3.12-alpine
|
image: python:3.12-alpine
|
||||||
commands:
|
commands:
|
||||||
|
@ -27,3 +35,9 @@ steps:
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- tag
|
- tag
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- pr
|
||||||
|
- push
|
||||||
|
- tag
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
|
|
||||||
from i18nfield.forms import I18nModelForm
|
from i18nfield.forms import I18nModelForm
|
||||||
|
|
||||||
from .models import MusicrateSettings
|
from .models import MusicrateSettings
|
||||||
|
|
||||||
|
|
||||||
class MusicrateSettingsForm(I18nModelForm):
|
class MusicrateSettingsForm(I18nModelForm):
|
||||||
|
|
||||||
def __init__(self, *args, event=None, **kwargs):
|
def __init__(self, *args, event=None, **kwargs):
|
||||||
self.instance, _ = MusicrateSettings.objects.get_or_create(event=event)
|
self.instance, _ = MusicrateSettings.objects.get_or_create(event=event)
|
||||||
super().__init__(*args, **kwargs, instance=self.instance, locales=event.locales)
|
super().__init__(*args, **kwargs, instance=self.instance, locales=event.locales)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = MusicrateSettings
|
model = MusicrateSettings
|
||||||
fields = ("some_setting", )
|
fields = ("some_setting",)
|
||||||
widgets = {}
|
widgets = {}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MusicrateSettings(models.Model):
|
class MusicrateSettings(models.Model):
|
||||||
event = models.OneToOneField(
|
event = models.OneToOneField(
|
||||||
to="event.Event",
|
to="event.Event",
|
||||||
|
@ -10,4 +8,3 @@ class MusicrateSettings(models.Model):
|
||||||
related_name="pretalx_musicrate_settings",
|
related_name="pretalx_musicrate_settings",
|
||||||
)
|
)
|
||||||
some_setting = models.CharField(max_length=10, default="A")
|
some_setting = models.CharField(max_length=10, default="A")
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from pretalx.orga.signals import nav_event_settings
|
from pretalx.orga.signals import nav_event_settings
|
||||||
|
@ -19,4 +18,3 @@ def pretalx_musicrate_settings(sender, request, **kwargs):
|
||||||
== "plugins:pretalx_musicrate:settings",
|
== "plugins:pretalx_musicrate:settings",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
from django.urls import re_path
|
from django.urls import re_path
|
||||||
from pretalx.event.models.event import SLUG_REGEX
|
from pretalx.event.models.event import SLUG_REGEX
|
||||||
|
|
||||||
|
@ -11,4 +10,3 @@ urlpatterns = [
|
||||||
name="settings",
|
name="settings",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ from django.utils.translation import gettext_lazy as _
|
||||||
from django.views.generic import FormView
|
from django.views.generic import FormView
|
||||||
from pretalx.common.mixins.views import PermissionRequired
|
from pretalx.common.mixins.views import PermissionRequired
|
||||||
|
|
||||||
|
|
||||||
from .forms import MusicrateSettingsForm
|
from .forms import MusicrateSettingsForm
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +24,7 @@ class MusicrateSettingsView(PermissionRequired, FormView):
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
form.save()
|
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)
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue