Hello All,

I am pulling my hair out.  I am trying to redirect the view button on a 
smartgrid.  I can get the button to redirect to the view I want, but I 
cannot parse the URL correctly to get the correct sheet id.

Here is my controller

@auth.requires_membership('manager')
def manage_customers():
    if 'new' in request.args:
        if request.args(2) == 'customer':
            redirect(URL('new_customer'))
        elif request.args(4) == 'sheet':
            redirect(URL('new_sheet', args=request.args(2)))
    if 'edit' in request.args:
        if request.args(4) == 'sheet':
            redirect(URL('edit_sheet', args=request.args(2)))
    if 'view' in request.args:
        if request.args(4) == 'sheet':
            redirect(URL('view_sheet', args=request.args(2,5)))
        elif request.args(6) == 'sheet_archive':
            redirect(URL('view_sheet', args=request.args(7)))
    form = SQLFORM.smartgrid(db.customer, linked_tables=['address', 
'sheet', 'sheet_archive'],
                             searchable= dict(customer=True, address=False, 
sheet=False),
                             editable= dict(customer=True, address=True, 
sheet=True, sheet_archive=False),
                             deletable= dict(customer=True, address=True, 
sheet=True, sheet_archive=False),
                             create=dict(customer=True, address=True, 
sheet=True, sheet_archive=False),
                             paginate=20, maxtextlength=60, 
fields=[db.customer.first_name,
                             db.customer.last_name, db.customer.phone, 
db.customer.email, db.customer.handed,
                             db.address.address1, db.address.address2, 
db.address.city, db.address.state_province,
                             db.address.postal_code, db.sheet.title, 
db.sheet.created_by, db.sheet.created_on,
                             db.sheet_archive.id, db.sheet_archive.title, 
db.sheet_archive.created_by,
                             db.sheet_archive.created_on],)
    return dict(form=form, request=request)

Here is my URL:

http://127.0.0.1:8000/manage_customers/customer/sheet.customer_id/1/edit/sheet/2?_signature=3b4a45778f06aec42421ef503cba968cd633269a


I can only get the customer_id and not the sheet #2.  So I am always 
displaying the first customer record and the first sheet record.  SO LOST.

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

Reply via email to