Re: [web2py] Re: Dont allow delete specific records in grid

2019-01-28 Thread Carlos Cesar Caballero Díaz

Thanks a lot Antony, that's exactly what I need.

Greetings.

El 28/1/19 a las 8:22 a.m., Anthony escribió:

You might find this helpful: https://stackoverflow.com/a/54200430/440323

Note, using the deletable argument in this case could be a bit 
inefficient because it will need to do a database select for each row 
in the grid to determine if there are any children. I suppose you 
could instead do a single join query before creating the grid to fetch 
the same set of records along with a count of any children and then 
just do a lookup in that local Rows object from the deletable function.


Anthony

On Sunday, January 27, 2019 at 12:55:04 PM UTC-5, Carlos Cesar 
Caballero wrote:


Hi, is possible to don't allow deleting specific records in the grid?

Basically, I have a one to many relation "parent has childs", but
it is
in cascade mode and I can't change it, so, I need to forbid
deleting of
parent records who has childs.


Greetings.


--
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.


--
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.


[web2py] Re: Dont allow delete specific records in grid

2019-01-28 Thread Anthony
You might find this helpful: https://stackoverflow.com/a/54200430/440323

Note, using the deletable argument in this case could be a bit inefficient 
because it will need to do a database select for each row in the grid to 
determine if there are any children. I suppose you could instead do a 
single join query before creating the grid to fetch the same set of records 
along with a count of any children and then just do a lookup in that local 
Rows object from the deletable function.

Anthony

On Sunday, January 27, 2019 at 12:55:04 PM UTC-5, Carlos Cesar Caballero 
wrote:
>
> Hi, is possible to don't allow deleting specific records in the grid? 
>
> Basically, I have a one to many relation "parent has childs", but it is 
> in cascade mode and I can't change it, so, I need to forbid deleting of 
> parent records who has childs. 
>
>
> Greetings. 
>
>
>

-- 
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.