--
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.
What do you mean you cannot send vars? Exactly what is happening? Please show more code.
http://mydomain/myapp/settings/deactivate/vars={(s,'2')}
--
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.
Yes, but what problem do you observe? Are the URLs not getting generated properly? Is the value not available in request.get_vars? What happens when you click? Can you show the code of the action associated with that URL?
--
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.
HelloSo I managed to put link and create it but now I have a probelm getting the id of the record I want to deal withlinks = [lambda row: A('',_class='glyphicon glyphicon glyphicon-remove-sign',callback=URL('settings','deactivate',vars=dict(table='skills',field = 'sk_status', value = form.vars.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"]
id = request.vars.value
--
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.
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
--
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.
row.workers_skills.id
row.get('workers_skills', row).id
I dont have special function for edit. When I click the icon on to edit the record I get this error. I did not wrote any special function. I am using web2py's
2015-11-01 11:38 GMT+08:00 Anthony:
On Friday, October 30, 2015 at 11:03:18 PM UTC-4, Yebach wrote: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
I'm not sure I follow. What do you mean by "go to edit"? Assuming edit is a separate action/page, how could the callback URL you are using for delete affect the edit action? Can you show the code related to editing?
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+unsubscribe@googlegroups.com.
I see the problem. When the grid involves a join, you must refer to fields within a row via the row.table.field format. However, when you view/edit a record from such a grid, only the record from a single table is shown (i.e., there is no longer a join involved), so you must now refer to fields within a row via the row.field format. Because your "link" appears in the grid as well as in the view/edit page, whichever format you use to refer to the id field, it will result in an error in one of those two contexts.
So, all you need to do is ensure your code works in both contexts. Here's a simple trick:
Instead of:
row.workers_skills.id
do:
row.get('workers_skills', row).id
The .get() method retrieves the 'workers_skills' key, but if it doesn't exist, it instead returns a default value, which in this case is just the original row. We then retrieve the "id" field of that returned object (either the original row or the row.workers_skills sub-row).
This is a tricky problem to fix in a general way. The grid could automatically set the "compact" attribute of the Rows object to False whenever the grid involves a join, even when calling the view/edit actions, which would enable a consistent interface for accessing field values. However, that would then cause problems with widgets and represent attributes defined on the database fields, which would be expecting row.field syntax.
In fact, there is a more general problem here -- any field represent attribute that accesses other fields in the row will fail if the row is part of a join.
Anthony
On Sunday, November 1, 2015 at 1:08:04 AM UTC-4, Yebach wrote:
I dont have special function for edit. When I click the icon on to edit the record I get this error. I did not wrote any special function. I am using web2py's
2015-11-01 11:38 GMT+08:00 Anthony:
On Friday, October 30, 2015 at 11:03:18 PM UTC-4, Yebach wrote: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
I'm not sure I follow. What do you mean by "go to edit"? Assuming edit is a separate action/page, how could the callback URL you are using for delete affect the edit action? Can you show the code related to editing?
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.
--Lep pozdravVid 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.