My whole function
@auth.requires_login() def workers_skills(): user = auth.user_id org = db(db.auth_user.id == user).select(db.auth_user.organization)[0]["organization"] db.workers_skills.ws_organisation.default = org query=((db.workers_skills.ws_organisation == org) & (db.workers_skills.ws_status == 1)) # select(db.workers_skills.ws_priority, # db.workers_skills.ws_worker, # db.workers.w_first_name, # db.workers.w_last_name, # db.skills.sk_name, query_inactive = db((db.workers_skills.ws_organisation == org) & (db.workers_skills.ws_status == 100))\ .select( db.workers_skills.id, db.workers.w_nick_name, db.skills.sk_name, db.workers_skills.ws_status, db.workers_skills.ws_priority, join=[db.workers.on(db.workers.id==db.workers_skills.ws_skill), db.skills.on(db.skills.id==db.workers_skills.ws_skill)], orderby=db.workers_skills.ws_worker).as_list() fields = (db.workers_skills.id, db.workers.w_first_name, db.workers.w_last_name, db.skills.sk_name, db.workers_skills.ws_priority ) #Let's specify a default sort order on date_of_birth column in grid default_sort_order=[db.workers.w_last_name] db.workers_skills.ws_organisation.readable = db.workers_skills.ws_organisation.writable = False db.workers_skills.ws_worker.requires= IS_IN_DB(db(db.workers.w_organisation == org),db.workers.id,'%(w_last_name)s %(w_first_name)s',zero=T('Select worker')) db.workers_skills.ws_skill.requires= IS_IN_DB(db(db.skills.sk_organisation == org),db.skills.id,'%(sk_name)s',zero=T('Select skill')) #Nardiš polje bl text like :) WIU WIU db.workers_skills.ws_priority.widget = SQLFORM.widgets.integer.widget #VAlidatorji #db.workers.w_status.requires = IS_IN_DB(db,db.status.s_code) #tega sm rešu v db.py # db.workers_skills.ws_worker.requires = [IS_NOT_EMPTY(error_message=T('Missing worker name'))] # db.workers_skills.ws_skill.requires = [IS_NOT_EMPTY(error_message=T('Missing skill name'))] db.workers_skills.ws_priority.requires = [IS_NOT_EMPTY(error_message=T('Missing priority level'))] links = [lambda row: A('',_class='glyphicon glyphicon glyphicon-remove-sign', callback=URL('settings','deactivate',vars=dict(table='workers_skills',field = 'ws_status' ,value = row.workers_skills.id )))] grid_workersskills= SQLFORM.grid(query=query,left=[db.workers.on(db.workers_skills.ws_worker== db.workers.id), db.skills.on(db.workers_skills.ws_skill==db.skills.id)], fields=fields, searchable=False, orderby=[db.workers.w_nick_name],create=True, deletable=False, editable=True, paginate=50, buttons_placement = 'right', showbuttontext = False, links = links, #oncreate=myfunction, ui = dict(widget='', header='', content='', default='', cornerall='', cornertop='', cornerbottom='', button='button btn btn-default', buttontext='buttontext button', buttonadd='icon plus icon-plus glyphicon glyphicon-plus', buttonback='icon leftarrow icon-arrow-left glyphicon glyphicon-arrow-left', buttonexport='icon downarrow icon-download glyphicon glyphicon-download', buttondelete='icon trash icon-trash glyphicon glyphicon-trash', buttonedit='icon pen icon-pencil glyphicon glyphicon-pencil', buttontable='icon rightarrow icon-arrow-right glyphicon glyphicon-arrow-right', buttonview='icon magnifier icon-zoom-in glyphicon glyphicon-eye-open', ), exportclasses = dict(csv_with_hidden_cols=False, html = False, tsv = False, tsv_with_hidden_cols=False, json = False)) return dict(grid_workersskills=grid_workersskills, query_inactive=query_inactive) 2015-10-31 11:03 GMT+08:00 Vid Ogris <vid.og...@gmail.com>: > The thing is IF I put links = [lambda row: A('',_class='glyphicon > glyphicon glyphicon-remove-sign', > callback=URL('settings','deactivate',vars=dict(table='workers_skills',field > = 'ws_status' > ,value = row.workers_skills.id )))] > > Then my function for "deleting" record works but when I want to go to edit > I get an error. If I put row.id then the oposite > > 2015-10-30 21:10 GMT+08:00 Niphlod <niph...@gmail.com>: > >> is your "id" in the grid ? id it's not in the fields then it's not >> accessible.... >> >> On Friday, October 30, 2015 at 2:41:41 AM UTC+1, Yebach wrote: >>> >>> why am I getting an error AttributeError: 'Row' object has no >>> attribute 'id' >>> >>> when I try to set links = [lambda row: A('',_class='glyphicon glyphicon >>> glyphicon-remove-sign', >>> callback=URL('settings','deactivate',vars=dict(table='workers_skills',field >>> = 'ws_status' >>> ,value = row.id )))], >>> >>> >>> >>> >>> >>> >>> 2015-09-23 22:44 GMT+08:00 A3 <a3v...@gmail.com>: >>> >>>> explained here: >>>> >>>> https://groups.google.com/d/msg/web2py/asCPsD9UGb8/ksmYX0UjBx0J >>>> >>>> Op dinsdag 22 september 2015 04:22:39 UTC+2 schreef Yebach: >>>>> >>>>> Ok thanx. This worked. >>>>> >>>>> One more question. My SQLFORM.grid is not refreshed after callback. So >>>>> record stays there. HOw to do a grid refresh? >>>>> >>>>> 2015-09-19 20:32 GMT+08:00 Anthony <abas...@gmail.com>: >>>>> >>>>>> On Saturday, September 19, 2015 at 4:18:49 AM UTC-4, Yebach wrote: >>>>>>> >>>>>>> Hello >>>>>>> >>>>>>> So I managed to put link and create it but now I have a probelm >>>>>>> getting the id of the record I want to deal with >>>>>>> >>>>>>> links = [lambda row: A('',_class='glyphicon glyphicon >>>>>>> glyphicon-remove-sign', >>>>>>> callback=URL('settings','deactivate',vars=dict(table='skills',field >>>>>>> = 'sk_status', value = form.vars.id )))] >>>>>>> >>>>>> >>>>>> If you want the id of the record in a given row of the table, then >>>>>> instead of value=form.vars.id, it should be value=row.id. >>>>>> >>>>>> >>>>>>> @auth.requires_login() def deactivate(): ##Aktiviramo delavca ko >>>>>>> user klikne na activate user = auth.user_id org = db(db.auth_user.id >>>>>>> == user).select(db.auth_user.organization)[0]["organization"] #Worker >>>>>>> je id >>>>>>> zaposlenenga ki ga damo v aktiven id = request.vars["id"] >>>>>>> >>>>>> >>>>>> In the URLs generated in the grid, you used the variable name >>>>>> "value", yet here you are looking for the variable name "id". The above >>>>>> line should be: >>>>>> >>>>>> id = request.vars.value >>>>>> >>>>>> Or you can change the URLs to use "id" as the variable name. >>>>>> >>>>>> Anthony >>>>>> >>>>>>> -- >>>>>> Resources: >>>>>> - http://web2py.com >>>>>> - http://web2py.com/book (Documentation) >>>>>> - http://github.com/web2py/web2py (Source code) >>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>>> --- >>>>>> You received this message because you are subscribed to a topic in >>>>>> the Google Groups "web2py-users" group. >>>>>> To unsubscribe from this topic, visit >>>>>> https://groups.google.com/d/topic/web2py/3T1Qaf39wJg/unsubscribe. >>>>>> To unsubscribe from this group and all its topics, send an email to >>>>>> web2py+un...@googlegroups.com. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Lep pozdrav >>>>> >>>>> Vid Ogris >>>>> >>>>> >>>>> -- >>>> Resources: >>>> - http://web2py.com >>>> - http://web2py.com/book (Documentation) >>>> - http://github.com/web2py/web2py (Source code) >>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>> --- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "web2py-users" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/web2py/3T1Qaf39wJg/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> web2py+un...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> Lep pozdrav >>> >>> Vid Ogris >>> >>> >>> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/3T1Qaf39wJg/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Lep pozdrav > > Vid Ogris > > > -- Lep pozdrav Vid Ogris -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.