Device and team creation: List events ordered and with date

This commit is contained in:
Raphael Michel
2019-10-04 16:59:47 +02:00
parent 0ed48fac7f
commit 9fca3188b2
3 changed files with 27 additions and 7 deletions

View File

@@ -177,7 +177,7 @@ class EventWizardBasicsForm(I18nModelForm):
return slug
class EventChoiceField(forms.ModelChoiceField):
class EventChoiceMixin:
def label_from_instance(self, obj):
return mark_safe('{}<br /><span class="text-muted">{} · {}</span>'.format(
escape(str(obj)),
@@ -186,6 +186,16 @@ class EventChoiceField(forms.ModelChoiceField):
))
class EventChoiceField(forms.ModelChoiceField):
pass
class SafeEventMultipleChoiceField(EventChoiceMixin, forms.ModelMultipleChoiceField):
def __init__(self, queryset, *args, **kwargs):
queryset = queryset.model.objects.none()
super().__init__(queryset, *args, **kwargs)
class EventWizardCopyForm(forms.Form):
@staticmethod