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.

Reply via email to