Hey Matthew, i have another view called viewPurchases that has a link that sends my args to the client_update controller, i didnt include it in the above code i thought is wasn't important it looks like this:
*viewPurchases VIEW* <table> <th>Client Surname</th> <th>Booked Room</th> <th>Reservation / Booking Status</th> <th>Booked By</th> {{for purchase in purchase:}} <tr> <td> {{=A(purchase.Surname, _href=URL('Client_Update', args=purchase.id))}} {{=purchase.Name}} </td> <td> Room {{=purchase.Items.Item}} </td> <td> {{=purchase.Booked_By.first_name}} {{=bookings.Booked_By.last_name}} </td> </tr> {{pass}} </table> *viewPurchases CONTROLLER* *def viewPurchases(): purchase=db(db.Customer).select(db.Customer.ALL, orderby=db.Customer.Surname) return locals()* On Friday, September 28, 2018 at 12:13:04 PM UTC+2, Matthew J Watts wrote: > > Looks like you are not sending/recieving your args properly ( > > For example You need to send args=Customer.id , from a button or > redirect for example > > You then need to request the Customer.id in the 'Client_Update' function > > So you'd need > > def Client_Update(): > client=request.args(0,cast=int) > > > > > > > On Friday, September 28, 2018 at 8:04:57 AM UTC+2, mostwanted wrote: >> >> I have 3 table, Items, Client & Purchases, the Client table stores the >> details of the customer, the items table has a list of sold items and >> Purchases stores what the customer purchased on what day. I have a function >> in the controller that allows the editing of Customer and Purchases details >> in one view by clicking on the owner's name but i keep getting the *Object >> not found *message caused an attempt at opening an edit for the >> Purchases table, what am i doing wrong, is there a better way of doing this? >> >> Regards >> >> Mostwanted >> >> *MODELS* >> db.define_table('Customer', >> Field('Name', requires=IS_NOT_EMPTY(), label=SPAN('First >> Name', _style="font-weight: bold;")), >> Field('Surname', requires=IS_NOT_EMPTY(), label=SPAN('Last >> Name', _style="font-weight: bold;")), >> Field('ID_Number', requirs=IS_NOT_EMPTY(), >> label=SPAN('Client >> ID No', _style="font-weight: bold;")), >> Field('Company', requirs=IS_NOT_EMPTY(), label=SPAN( >> 'Company', _style="font-weight: bold;")),format='%(Surname)s ), >> >> db.define_table('Items', >> Field('Item', requires=IS_NOT_EMPTY()), >> format='%(Item)s') >> >> db.define_table('Purchases', >> Field('Client', 'reference Customer', label=SPAN('Client', >> _style="font-weight: bold")), >> Field('Item', 'reference Item', unique=True, label=SPAN(' >> Item Purchased', _style="font-weight: bold;")), >> Field('Booking_Date', 'datetime', default=request.now, >> writable=False, label=SPAN('Date of Registration', _style="font-weight: >> bold;")), >> Field('Serviced_By', 'reference auth_user', >> default=auth.user_id, writable=False, label=SPAN('Serviced By', >> _style="font-weight: bold;"))) >> >> >> *CONTROLLER* >> def Client_Update(): >> client=db.Customer(request.args(0)) >> clientDetails=SQLFORM(db.Customer, client.id, deletable=True, showid= >> False).process() >> addRooms=SQLFORM(db.Purchases, client.id, deletable=True, showid= >> False).process() >> return locals() >> >> *VIEW* >> {{extend 'layout.html'}} >> >> <div> >> <span class="formTitle">VIEW & UPDATE CLIENT DETAILS</span> >> {{=clientDetails}} >> <hr /> >> <span class="formTitle">VIEW & UPDATE CLIENT PURCHASES</span> >> {{=addRooms}} >> </div> >> {{pass}} >> >> >> -- 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.