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):
|
||||
|
||||
presentation = forms.ModelChoiceField(queryset=Presentation.objects.all())
|
||||
presentation = forms.ModelChoiceField(queryset=Presentation.objects.none())
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
content = kwargs.pop("content", None)
|
||||
if content:
|
||||
kwargs.setdefault("initial", {})["presentation"] = content
|
||||
super(SlotEditForm, self).__init__(*args, **kwargs)
|
||||
queryset = self.fields["presentation"].queryset
|
||||
queryset = Presentation.objects.order_by("proposal_base__pk")
|
||||
if content:
|
||||
queryset = queryset.filter(Q(slot=None) | Q(pk=content.pk))
|
||||
self.fields["presentation"].required = False
|
||||
|
|
Loading…
Reference in a new issue