class LineaBaseForm(TableForm): #action = 'CrearLineaBase' #genre_options = [x for x in (DBSession.query(Group).filter_by(group_name="lider").one()).users] item_options = [x for x in (DBSession.query(Item.id, Item.nombre))] fields = [ TextField('nombre', label_text='Nombre'), TextField('idFase', label_text='idFase'), Spacer(), #TextField('idItem', label_text='idItem'), MultipleSelectField('idItem', options=item_options, label_text='Items'), #SingleSelectField('idItem', options=item_options), Spacer(), TextField('estado', label_text='estado'), Spacer(), CalendarDatePicker('fechaCreacion', date_format='%d-%m-%y'), Spacer(), #SingleSelectField('liderProyecto', options=genre_options), #TextField('liderProyecto', label_text='Lider de Proyecto') ] submit_text = 'Crear LineaBase'
class MovieForm(TableForm): template = "toscasample.widgets.templates.table_form" css = [CSSLink(link=url('/css/tooltips.css'))] genre_options = enumerate(( 'Action & Adventure', 'Animation', 'Comedy', 'Documentary', 'Drama', 'Sci-Fi & Fantasy')) fields = [ TextField('title', label_text='Movie Title', help_text='Please enter the full title of the movie.'), Spacer(), TextField('year', size=4, help_text='Please enter the year this movie was made.'), CalendarDatePicker('release_date', date_format='%y-%m-%d', help_text='Please pick the exact release date.'), SingleSelectField('genre', options=genre_options, help_text = 'Please choose the genre of the movie.'), Spacer(), TextArea('description', attrs=dict(rows=3, cols=25), help_text = 'Please provide a short description of the plot.'), Spacer()] submit_text = 'Save Movie'
class MovieForm(TableForm): hover_help = True genre_options = [ x for x in enumerate(('Action & Adventure', 'Animation', 'Comedy', 'Documentary', 'Drama', 'Sci-Fi & Fantasy')) ] fields = [ TextField('title', label_text='Movie Title', help_text='Please enter the full title of the movie.'), Spacer(), TextField('year', size=4, help_text='Please enter the year this movie was made.'), CalendarDatePicker('release_date', date_format='%y-%m-%d', help_text='Please pick the exact release date.'), SingleSelectField('genre', options=genre_options, help_text='Please choose the genre of the movie.'), Spacer(), TextArea('description', attrs=dict(rows=3, cols=25), help_text='Please provide a short description of the plot.'), Spacer() ] submit_text = 'Save Movie'
class fields(WidgetsList): title = TextField(validator=NotEmpty) author = TextField(validator=NotEmpty) description = TextArea(attrs=dict(rows=3, cols=25)) date_taken = CalendarDatePicker(validator=DateConverter()) subject_list = ((1, "Philosophy"), (2, "Maths"), (3, "Literature"), (4, "History"), (5, "Politics"), (6, "Sociology")) subject = SingleSelectField(options=subject_list)
class fields(WidgetsList): title = TextField() year = TextField() release_date = CalendarDatePicker() genre_options = enumerate(('Action & Adventure', 'Animation', 'Comedy', 'Documentary', 'Drama', 'Sci-Fi & Fantasy')) genre = SingleSelectField(options=genre_options) description = TextArea()
class ProyectoEditForm(EditableForm): __model__ = Proyecto lider_options = [] __field_widgets__ = { 'nombre': TextField('nombre', validator=NotEmpty, label_text='Nombre'), 'descripcion': TextField('descripcion', label_text='Descripcion'), 'liderProyecto': CalendarDatePicker('fechaCreacion', date_format='%d-%m-%y'), 'estado': SingleSelectField('liderProyecto', options=lider_options) } __omit_fields__ = ['id', 'fechaCreacion', 'nrofase'] submit_text = 'Editar Proyecto'
class MovieForm(TableForm): genre_options = enumerate(('Action & Adventure', 'Animation', 'Comedy', 'Documentary', 'Drama', 'Sci-Fi & Fantasy')) fields = [ TextField('title', label_text='Movie Title'), Spacer(), TextField('year', size=4), CalendarDatePicker('release_date', date_format='%y-%m-%d'), SingleSelectField('genre', options=genre_options), Spacer(), Label(text='Please provide a short description of the plot:'), TextArea('description', attrs=dict(rows=3, cols=25)), Spacer() ] submit_text = 'Save Movie'
class MovieForm(TableForm): template = "toscasample.widgets.templates.table_form" css = [CSSLink(link=url('/css/tooltips.css'))] show_errors = True genre_options = [ x for x in enumerate(('Action & Adventure', 'Animation', 'Comedy', 'Documentary', 'Drama', 'Sci-Fi & Fantasy')) ] fields = [ TextField('title', validator=NotEmpty, label_text='Movie Title', help_text='Please enter the full title of the movie.'), Spacer(), TextField('year', validator=Int(min=1900, max=2100), size=4, help_text='Please enter the year this movie was made.'), CalendarDatePicker('release_date', validator=DateConverter(), help_text='Please pick the exact release date.'), SingleSelectField('genre', options=genre_options, help_text='Please choose the genre of the movie.'), Spacer(), TextArea('description', attrs=dict(rows=3, cols=25), help_text='Please provide a short description of the plot.'), Spacer(), FileField('picture_filename', help_text='Please provide a picture for this movie.'), Spacer() ] submit_text = 'Save Movie'
class ProyectoForm(TableForm): hover_help = True show_errors = True fields = [ HiddenField('id_proyecto', label_text='Id', help_text='Id del Proyecto'), HiddenField('id_usuario', label_text='id_usuario', help_text='Id del Usuario.'), Spacer(), TextField('nombre', validator=NotEmpty, label_text='Nombre', size=38, help_text='Introduzca su Nombre completo.'), Spacer(), TextArea('descripcion', label_text='Descripcion', attrs=dict(rows=10, cols=50), help_text='Introduzca una descripcion del Proyecto'), Spacer(), CalendarDatePicker('fecha', date_format='%d/%m/%Y', help_text='Seleccione la fecha de Creacion del Proyecto'), Spacer(), CheckBox('iniciado', disabled='False', label_text='Iniciado', help_text='Indica si el proyecto se ha iniciado')] submit_text = 'Guardar Proyecto'
def new(self, tid=None, *args, **kw): """Display a page to show a new record.""" fid = DBSession.query(TipoDeItem.idFase).filter_by(id=tid).first() comlejidadoptions = [(1, 'Muy Baja (1)'), (2, 'Baja (2)'), (3, 'Media (3)'), (4, 'Alta (4)'), (5, 'Muy Alta (5)')] campos = [ TextField('nombre', label_text='Nombre', disabled=True), Spacer(), HiddenField('idFase', label_text='idFase'), HiddenField('version', label_text='version'), HiddenField('estado', label_text='estado'), SingleSelectField('complejidad', options=comlejidadoptions, label_text='complejidad'), Spacer(), HiddenField('nrohistorial', label_text='nrohistorial'), HiddenField('idTipoDeItem', label_text='idTipoDeItem'), ] camponombre = DBSession.query( Campos.tipoDeDato, Campos.nombre, Campos.id).filter_by(idTipoDeItem=tid).all() for ct in camponombre: #log.debug(ct[1]) if str(ct[0]).__eq__('date'): campo1 = CalendarDatePicker(str(ct[2]), label_text=ct[1] + ' (' + ct[0] + ')', date_format='%d/%m/%Y') else: campo1 = TextField(str(ct[2]), label_text=ct[1] + ' (' + ct[0] + ')') campos.append(campo1) campos.append(Spacer()) #self.new_form = TableForm('tf', fields=campos, submit_text='Guardar') #tmpl_context.widget = self.new_form tmpl_context.widget = TableForm('create_table_form', fields=campos, submit_text='Guardar') """El tipo de Item elegido es extraido para asignar su nombre al item""" tipo_item_elegido = DBSession.query(TipoDeItem).filter_by( id=tid).first() nrogenerado = tipo_item_elegido.nrogeneracion + 1 if int(nrogenerado) < 10: nombreitem = tipo_item_elegido.nombre + '-00' + str(nrogenerado) elif int(nrogenerado) < 100: nombreitem = tipo_item_elegido.nombre + '-0' + str(nrogenerado) else: nombreitem = tipo_item_elegido.nombre + '-' + str(nrogenerado) return dict(value={ 'idTipoDeItem': tid, 'idFase': fid, 'nombre': nombreitem }, model=self.model.__name__)