from eventmanager.eventos.models import \
TipoTrabalho, CategoriaTrabalho, Palestrante, STATE_CHOICES
-MKCHOICES = lambda K:[(x.id, str(x)) for x in K.objects.all()]
+MKCHOICES = lambda K, xid=-1:[(x.id, str(x)) for x in K.objects.all() \
+ if xid != x.id]
class SubmeterTrabalho(forms.Form):
- def __init__(self, *args, **kwargs):
+ def __init__(self, request, *args, **kwargs):
super(SubmeterTrabalho, self).__init__(*args, **kwargs)
newchoices = MKCHOICES(TipoTrabalho)
self.fields['tipo'].choices = newchoices
- newchoices = MKCHOICES(Palestrante)
+ palestrante = request.user.palestrante_set.get()
+ newchoices = MKCHOICES(Palestrante, xid=palestrante.id)
self.fields['outros_palestrantes'].choices = newchoices
titulo = forms.CharField(max_length=100, label='Título do trabalho')