+
+ # These fields should not be shown to the user.
+ form.fields['palestrante'].widget = HiddenInput()
+ form.fields['evento'].widget = HiddenInput()
+
+ # These fields are event specific
+ trilhas = Trilha.objects.filter(evento=event)
+ form.fields['trilha']._set_queryset(trilhas)
+
+ tipos = TipoTrabalho.objects.filter(evento=event)
+ form.fields['tipo']._set_queryset(tipos)
+
+ # hidding the owner in the other speakers list
+ other = Palestrante.objects.exclude(pk=entity.id)
+ form.fields['outros_palestrantes']._set_queryset(other)
+ if other.count() == 0:
+ # I need set the value to '', otherwise the wise django
+ # newforms will fill the field with the invalid string '[]'
+ form.fields['outros_palestrantes'].initial = ''
+ form.fields['outros_palestrantes'].widget = HiddenInput()
+