I have an SQLFORM.grid w/ an ondelete calling a function customer_delete(). 
However, the the function is not being called and the records are not 
actually being deleted from the DB. If I remove the 
"ondelete=customer_delete" in my grid args, the records are being deleted. 
The way I understand it, ondelete should delete the record, then call 
customer_delete, and it's not doing either. Do I have my function 
definition correct for customer_delete? 

    
def index():
    grid = SQLFORM.grid(db.Customer, oncreate=customer_create, ondelete=
customer_delete)
    return dict(grid=grid)

def customer_create(form):
    # add the customer's id into the group table so we can use it for 
permissions
    # so the customer's ID is the STRING NAME of the ROLE in the group table
    from gluon.tools import Auth
    auth = Auth(db)
    response.flash = T("Customer added.")
    auth.add_group(form.vars.id, form.vars.customer_name)
    
def customer_delete():
    # if we delete a customer, remove the group
    response.flash = "Test"
    from gluon.tools import Auth
    auth = Auth(db)
    response.flash = T(request.get_vars.id)
    auth.del_group(auth.id_group(role=str(request.get_vars.id)))

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to