Hello Richard and Anthony,

Thanks very much for your reply.

Here is the traceback:

Traceback (most recent call last):
  File 
"C:\Users\Acer\Desktop\web2py_new\web2py_win\web2py\gluon\restricted.py", line 
227, in restricted
    exec ccode in environment
  File 
"C:/Users/Acer/Desktop/web2py_new/web2py_win/web2py/applications/new_de_media/controllers/appadmin.py"
 
<http://127.0.0.1:8000/admin/default/edit/new_de_media/controllers/appadmin.py>,
 line 703, in <module>
  File "C:\Users\Acer\Desktop\web2py_new\web2py_win\web2py\gluon\globals.py", 
line 412, in <lambda>
    self._caller = lambda f: f()
  File 
"C:/Users/Acer/Desktop/web2py_new/web2py_win/web2py/applications/new_de_media/controllers/appadmin.py"
 
<http://127.0.0.1:8000/admin/default/edit/new_de_media/controllers/appadmin.py>,
 line 341, in update
    f='download', args=request.args[:1]))
  File "C:\Users\Acer\Desktop\web2py_new\web2py_win\web2py\gluon\sqlhtml.py", 
line 1201, in __init__
    self.record_id = str(record[field.name])
  File 
"C:\Users\Acer\Desktop\web2py_new\web2py_win\web2py\gluon\packages\dal\pydal\objects.py",
 line 76, in __getitem__
    raise KeyError
KeyError



Web2py version:Version 2.12.3-stable+timestamp.2015.08.19.00.18.03

This is the Controller:

def contact():
    form = SQLFORM(db.table_name)
    from gluon.tools import Mail
    mail = Mail()
    mail.settings.server = 'xxxxxxxx'
    mail.settings.sender = 'xxxxxxxxxxx'
    mail.settings.login = 'xxxxxxxxxxxxxxx'
    if form.process().accepted:
        mail.send(to=['xxxxxxxxxxxxxx'],
        subject='xxxxxxxxxxxxxxxx',
        reply_to='xxxxxxxxxxxxxxxxxxx',
        message='xxxxxxxxxxxxxxxxxxxxxxx')
        redirect(URL('thank_you'))
    return dict(form=form)

and the tables:

db.define_table('table_name',
    Field(' first_name', 'string', requires=IS_NOT_EMPTY()), Field(' 
last_name', 'string', requires=IS_NOT_EMPTY()), Field('company_name', 
'string', requires=IS_NOT_EMPTY()), Field('email', 
requires=[IS_NOT_EMPTY(), IS_EMAIL()]), Field('website', 
requires=[IS_NOT_EMPTY(), IS_URL()]), Field('your_message', 'text', 
requires=IS_NOT_EMPTY()), Field('date_made', 'datetime', default = 
request.now, writable=False, readable=False, requires = 
IS_DATE(format=('%d-%m-%Y'))))

To be more clear, in the  database administration, in db.table_name, in 
column db.table_name.id, when I click to select a row by ID I get this 
error.

Thanks again for helping me with this.

Cheers,

Joe


On Thursday, June 16, 2016 at 2:53:20 AM UTC+8, Richard wrote:
>
> I think we would need more details, web2py version, more code, click on ID 
> number?? in grid?
>
> Richard
>
> On Wed, Jun 15, 2016 at 1:36 AM, Joe <[email protected] <javascript:>> 
> wrote:
>
>> I can't understand what could possibly cause this. When I submit the 
>> form, the form is processed, the page is redirected, email sent and the 
>> records stored in the DB table as expected.
>> But, when I click on the ID number of the row in the table, trying to 
>> access the records, as I always do, I get a <type 'exceptions.KeyError'>.
>>
>> The form in the controller:
>> form = SQLFORM(db.table_name)
>>
>> This never happened before, so I have no idea what the problem is. Can 
>> anyone help me with this?
>>
>> Thanks very much.
>>
>> Joe
>>
>> -- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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