added ordering to presentations
This commit is contained in:
parent
f98a3f2f9a
commit
453a443b5f
1 changed files with 2 additions and 2 deletions
|
@ -6,14 +6,14 @@ from symposion.schedule.models import Presentation
|
||||||
|
|
||||||
class SlotEditForm(forms.Form):
|
class SlotEditForm(forms.Form):
|
||||||
|
|
||||||
presentation = forms.ModelChoiceField(queryset=Presentation.objects.all())
|
presentation = forms.ModelChoiceField(queryset=Presentation.objects.none())
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
content = kwargs.pop("content", None)
|
content = kwargs.pop("content", None)
|
||||||
if content:
|
if content:
|
||||||
kwargs.setdefault("initial", {})["presentation"] = content
|
kwargs.setdefault("initial", {})["presentation"] = content
|
||||||
super(SlotEditForm, self).__init__(*args, **kwargs)
|
super(SlotEditForm, self).__init__(*args, **kwargs)
|
||||||
queryset = self.fields["presentation"].queryset
|
queryset = Presentation.objects.order_by("proposal_base__pk")
|
||||||
if content:
|
if content:
|
||||||
queryset = queryset.filter(Q(slot=None) | Q(pk=content.pk))
|
queryset = queryset.filter(Q(slot=None) | Q(pk=content.pk))
|
||||||
self.fields["presentation"].required = False
|
self.fields["presentation"].required = False
|
||||||
|
|
Loading…
Reference in a new issue