Compare commits
No commits in common. "f04e114062148f7e7e7f679e0d5e1988d29dcfda" and "a8ba987102a81be820fc0b3640be69efb679f7f3" have entirely different histories.
f04e114062
...
a8ba987102
|
@ -1,5 +1,5 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from django_scopes.forms import SafeModelChoiceField, SafeModelMultipleChoiceField
|
from django_scopes.forms import SafeModelMultipleChoiceField
|
||||||
from i18nfield.forms import I18nModelForm
|
from i18nfield.forms import I18nModelForm
|
||||||
|
|
||||||
from .models import MusicrateSettings
|
from .models import MusicrateSettings
|
||||||
|
@ -13,27 +13,13 @@ class MusicrateSettingsForm(I18nModelForm):
|
||||||
self.fields.pop("submission_types")
|
self.fields.pop("submission_types")
|
||||||
else:
|
else:
|
||||||
self.fields["submission_types"].queryset = event.submission_types.all()
|
self.fields["submission_types"].queryset = event.submission_types.all()
|
||||||
self.fields["genre_question"].queryset = (
|
|
||||||
event.questions.exclude(pk=self.instance.origin_question.pk)
|
|
||||||
if self.instance.origin_question
|
|
||||||
else event.questions.all()
|
|
||||||
)
|
|
||||||
self.fields["origin_question"].queryset = (
|
|
||||||
event.questions.exclude(pk=self.instance.genre_question.pk)
|
|
||||||
if self.instance.genre_question
|
|
||||||
else event.questions.all()
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = MusicrateSettings
|
model = MusicrateSettings
|
||||||
fields = ("submission_types", "genre_question", "origin_question")
|
fields = ("submission_types",)
|
||||||
widgets = {
|
widgets = {
|
||||||
"submission_types": forms.SelectMultiple(attrs={"class": "select2"}),
|
"submission_types": forms.SelectMultiple(attrs={"class": "select2"}),
|
||||||
"genre_question": forms.Select(attrs={"class": "select2"}),
|
|
||||||
"origin_question": forms.Select(attrs={"class": "select2"}),
|
|
||||||
}
|
}
|
||||||
field_classes = {
|
field_classes = {
|
||||||
"submission_types": SafeModelMultipleChoiceField,
|
"submission_types": SafeModelMultipleChoiceField,
|
||||||
"genre_question": SafeModelChoiceField,
|
|
||||||
"origin_question": SafeModelChoiceField,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
# Generated by Django 4.2.8 on 2023-12-14 22:47
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
dependencies = [
|
|
||||||
("submission", "0074_created_updated_everywhere"),
|
|
||||||
("pretalx_musicrate", "0001_initial"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="musicratesettings",
|
|
||||||
name="genre_question",
|
|
||||||
field=models.OneToOneField(
|
|
||||||
null=True,
|
|
||||||
on_delete=django.db.models.deletion.SET_NULL,
|
|
||||||
related_name="pretalx_musicrate_settings_genre",
|
|
||||||
to="submission.question",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="musicratesettings",
|
|
||||||
name="origin_question",
|
|
||||||
field=models.OneToOneField(
|
|
||||||
null=True,
|
|
||||||
on_delete=django.db.models.deletion.SET_NULL,
|
|
||||||
related_name="pretalx_musicrate_settings_origin",
|
|
||||||
to="submission.question",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -17,19 +17,3 @@ class MusicrateSettings(models.Model):
|
||||||
verbose_name=_("Session Types"),
|
verbose_name=_("Session Types"),
|
||||||
blank=True,
|
blank=True,
|
||||||
)
|
)
|
||||||
genre_question = models.OneToOneField(
|
|
||||||
to="submission.Question",
|
|
||||||
on_delete=models.SET_NULL,
|
|
||||||
related_name="pretalx_musicrate_settings_genre",
|
|
||||||
verbose_name=_("Genre Question"),
|
|
||||||
blank=True,
|
|
||||||
null=True,
|
|
||||||
)
|
|
||||||
origin_question = models.OneToOneField(
|
|
||||||
to="submission.Question",
|
|
||||||
on_delete=models.SET_NULL,
|
|
||||||
related_name="pretalx_musicrate_settings_origin",
|
|
||||||
verbose_name=_("Origin Question"),
|
|
||||||
blank=True,
|
|
||||||
null=True,
|
|
||||||
)
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% bootstrap_form_errors form %}
|
{% bootstrap_form_errors form %}
|
||||||
{% bootstrap_field form.submission_types layout='event' %}
|
{% bootstrap_field form.submission_types layout='event' %}
|
||||||
{% bootstrap_field form.genre_question layout='event' %}
|
|
||||||
{% bootstrap_field form.origin_question layout='event' %}
|
|
||||||
{% include "orga/includes/submit_row.html" %}
|
{% include "orga/includes/submit_row.html" %}
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -12,11 +12,7 @@ maintainers = [
|
||||||
{name = "Luca", email = "Luca@hackerspace-bamberg.de"},
|
{name = "Luca", email = "Luca@hackerspace-bamberg.de"},
|
||||||
]
|
]
|
||||||
|
|
||||||
dependencies = [
|
dependencies = []
|
||||||
"Django",
|
|
||||||
"django-i18nfield",
|
|
||||||
"pretalx",
|
|
||||||
]
|
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
homepage = "https://git.luj0ga.de/kontakt/pretalx-musicrate"
|
homepage = "https://git.luj0ga.de/kontakt/pretalx-musicrate"
|
||||||
|
|
Loading…
Reference in New Issue