And what about something like this: Field('image_filename', readable=False, writable=False, compute = lambda row: request.post_vars.image.filename + next_id())
def next_id(): last_row = db().select(db.table.id).last() last_id = int(last_row[`table.id`]) return last_id + 1 This was written from my cel phone and dont test it but hope that helps ;-) El mar 27, 2013 3:25 PM, "Roberto Perdomo" <roberto...@gmail.com> escribió: > :-S > I was thinking on represent attribute from fields, not compute. > El mar 27, 2013 3:07 PM, "Niphlod" <niph...@gmail.com> escribió: > >> boys ..... how can the id be present if what you're trying to insert is >> not yet a row in a table ???? >> >> On Wednesday, March 27, 2013 8:18:38 PM UTC+1, Roberto Perdomo wrote: >>> >>> Ummm, the id is readable? >>> >>> db.table.id.readable = True >>> El mar 27, 2013 12:55 PM, "Tito Garrido" <titog...@gmail.com> escribió: >>> >>>> I just checked... id is not present: >>>> "<Row {'artista': 387, 'nome': 'aaaa', 'image': 'personagem.image.** >>>> b2754a53c6cdcc7e.**69626d2d4c6f676f2e6a7067.jpg', 'novela': '9', >>>> 'slug': 'aaaa', 'descricao': 'aaaa'}>" >>>> >>>> >>>> On Wed, Mar 27, 2013 at 2:24 PM, Roberto Perdomo <rober...@gmail.com>wrote: >>>> >>>>> Try: >>>>> >>>>> Field('image_filename', readable=False, writable=False, compute = >>>>> lambda row: request.post_vars.image.**filename + row.id), >>>>> El mar 27, 2013 12:39 PM, "Tito Garrido" <titog...@gmail.com> >>>>> escribió: >>>>> >>>>> How could I also append the id of the row in image_filename? >>>>>> >>>>>> Thanks! >>>>>> >>>>>> Tito >>>>>> >>>>>> >>>>>> On Mon, Mar 25, 2013 at 4:58 PM, Tito Garrido <titog...@gmail.com>wrote: >>>>>> >>>>>>> Worked! It should go to the book :) http://web2py.com/books/** >>>>>>> default/chapter/29/07#Storing-**the-original-filename<http://web2py.com/books/default/chapter/29/07#Storing-the-original-filename> >>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> Tito >>>>>>> >>>>>>> >>>>>>> On Mon, Mar 25, 2013 at 4:53 PM, Massimo Di Pierro < >>>>>>> massimo....@gmail.com> wrote: >>>>>>> >>>>>>>> You can use this: >>>>>>>> Field('image_filename', readable=False, writable=False, compute = >>>>>>>> lambda row: request.post_vars.image.**filename), >>>>>>>> >>>>>>>> >>>>>>>> On Monday, 25 March 2013 13:28:19 UTC-5, Tito Garrido wrote: >>>>>>>>> >>>>>>>>> Hi! >>>>>>>>> >>>>>>>>> Why this does not work: >>>>>>>>> Field('image', 'upload', requires=IS_NOT_EMPTY(), >>>>>>>>> uploadseparate=True, autodelete=True,), >>>>>>>>> Field('image_filename', readable=False, writable=False, >>>>>>>>> compute = lambda row: row.image.filename), >>>>>>>>> >>>>>>>>> Using a form I can follow the book and fill the image filename: >>>>>>>>> if request.vars.image!=None: >>>>>>>>> try: >>>>>>>>> form.vars.image_filename = request.vars.image.filename >>>>>>>>> except: >>>>>>>>> form.vars.image_filename = request.vars.image >>>>>>>>> >>>>>>>>> How can I do the same using SQLFORM.grid? >>>>>>>>> >>>>>>>>> Regards, >>>>>>>>> >>>>>>>>> Tito >>>>>>>>> >>>>>>>>> -- >>>>>>>>> >>>>>>>>> Linux User #387870 >>>>>>>>> .........____ >>>>>>>>> .... _/_õ|__| >>>>>>>>> ..º[ .-.___.-._| . . . . >>>>>>>>> .__( o)__( o).:_______ >>>>>>>>> >>>>>>>> -- >>>>>>>> >>>>>>>> --- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "web2py-users" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to web2py+un...@**googlegroups.com. >>>>>>>> For more options, visit >>>>>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>>>>>> . >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> >>>>>>> Linux User #387870 >>>>>>> .........____ >>>>>>> .... _/_õ|__| >>>>>>> ..º[ .-.___.-._| . . . . >>>>>>> .__( o)__( o).:_______ >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>> Linux User #387870 >>>>>> .........____ >>>>>> .... _/_õ|__| >>>>>> ..º[ .-.___.-._| . . . . >>>>>> .__( o)__( o).:_______ >>>>>> >>>>>> -- >>>>>> >>>>>> --- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "web2py-users" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to web2py+un...@**googlegroups.com. >>>>>> For more options, visit >>>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>>>> . >>>>>> >>>>>> >>>>>> >>>>> -- >>>>> >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "web2py-users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to web2py+un...@**googlegroups.com. >>>>> For more options, visit >>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>>> . >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> -- >>>> >>>> Linux User #387870 >>>> .........____ >>>> .... _/_õ|__| >>>> ..º[ .-.___.-._| . . . . >>>> .__( o)__( o).:_______ >>>> >>>> -- >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "web2py-users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to web2py+un...@**googlegroups.com. >>>> For more options, visit >>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>> . >>>> >>>> >>>> >>> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.