# -*- coding: utf-8 -*-

from django import forms
from tarea.models import Actividad,Pregunta,Eleccion
from cuestionario.models import Cuestionario,Pregunta as PreguntaCuestionario,Eleccion as EleccionCuestionario
from app.models import Asignatura

class Add_Form_Actividad(forms.ModelForm):
    class Meta:
        model = Actividad
        fields = ['name','text','time','enddate']
        exclude=['autor','nr']
        widgets = {
            'name': forms.widgets.TextInput(attrs={"class":"input-xlarge"}),
            'text' : forms.widgets.Textarea(attrs={"class":"input-xlarge"}),
            'enddate' : forms.widgets.DateInput(attrs={"size":10, "class": "datepicker input-xlarge"}),
            'time' : forms.widgets.TimeInput(attrs={"size":10, "class": "timepicker input-xlarge"}),
        }

class ActividadPreguntaForm(forms.ModelForm):
    class Meta:
        model = Pregunta
        fields = ['text','val','type']
        widgets = {
            'text' :forms.widgets.Textarea(),
            'val': forms.widgets.TextInput(),
            'type' : forms.widgets.Select(attrs={"id":"tipo"},choices=((1, u'Abierta'), (2, u'Eleccion'), (3, u'Multieleccion'), (4, u'Verdadero/falso') , (5, u'Puntuacion'),(6, u'Imagen') )),
        }

class ActividadEditPreguntaForm(forms.ModelForm):
    class Meta:
        model = Pregunta
        fields = ['text','val']
        widgets = {
            'text' :forms.widgets.Textarea(),
            'val': forms.widgets.TextInput(),
        }

class ActividadEleccionForm(forms.ModelForm):
    class Meta:
        model = Eleccion
        exclude=['pregunta','nr','correct','val']

class NewCuestionarioForm(forms.ModelForm):
    class Meta:
        model = Cuestionario
        fields = ['enddate']
        widgets = {
            #'name': forms.widgets.TextInput(attrs={"class":"input-xlarge"}),
            #'text' : forms.widgets.Textarea(attrs={"class":"input-xlarge","cols":"10"}),
            'hide' : forms.widgets.CheckboxInput(),
            'enddate' : forms.widgets.DateInput(attrs={"size":10, "class": "datepicker input-xlarge"}),
        }

class NewQuestionForm(forms.ModelForm):
    class Meta:
        model = PreguntaCuestionario
        fields = ['text','type']
        widgets = {
            'text' :forms.widgets.Textarea(),
            'type' : forms.widgets.Select(choices=((1, u'Abierta'), (2, u'Eleccion'), (3, u'Multieleccion'), (4, u'Verdadero/falso') , (5, u'Puntuacion') )),
        }

class Edit_form_Pregunta_Cuestionario(forms.ModelForm):
    class Meta:
        model = PreguntaCuestionario
        fields = ['text','val']
        widgets = {
            'text' :forms.widgets.Textarea(),
            'val': forms.widgets.TextInput(),
        }
class NewChoiceForm(forms.ModelForm):
    class Meta:
        model = EleccionCuestionario
        fields = ['name']
        widgets = {
            'text' :forms.widgets.TextInput(),
        }
