My delete function is not working, I think I am doing doing something wrong 
but i'm not sure where, I thought the code below would get me home but 
nothing is happening, nothing is getting deleted! Please advice:

*DELETE FUNCTION CONTROLLER CODE:*
def deleteInvoice():
    query=db.invoice(request.args(0, cast=int))
    remove=db(db.invoice.customer==query.id).delete()
    if remove:
        redirect(URL('registeredClients'))
    return locals()



On Sunday, January 6, 2019 at 4:35:36 PM UTC+2, Anthony wrote:
>
> On Sunday, January 6, 2019 at 9:15:41 AM UTC-5, mostwanted wrote:
>>
>> Hey Anthony, thanks for the heads up in the garbage code in the 
>> controller i will address it, with regards to deleting invoices i want to 
>> be able to delete all invoices in the db.invoice table but only for a 
>> specific selected client. I want to be able to delete an entire invoice by 
>> clicking the link once.
>>
>
> Then you would need a query like:
>
> db(db.invoice.client = some_client_id).delete()
>
> You would want to make sure the current user is authorized to delete 
> invoices for some_client_id (specifically, if some_client_id comes from 
> the browser, be sure to validate it).
>
> Also, in the UI, you should probably make it clear what will happen, as 
> "Delete Invoice" makes me think I'm deleting only the current invoice, not 
> all invoices.
>
> 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 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.

Reply via email to