Without trying out the code I think the problem is the invalid format
string.
format = '%(partenza,partenza)s'
In a format string each variable is formatted separately as in
format = '%(partenza)s,%(partenza)s'
Look up "String Formatting Operations" in the Python manual for full
details.
By the way, these lines are duplicated in your code
db.esercizio_consorzio.id.readable = False
db.esercizio_consorzio.id.writable = False
maybe you want the second set to be
db.esercizio.id.readable = False
db.esercizio.id.writable = False
Denes
On Friday, November 6, 2015 at 5:40:13 AM UTC-5, Alessio Varalta wrote:
>
> Hi I have two table and I don't understand because I received a error when
> I enter in appadmin/esercizio...I use sqlite and I try to download the Csv
> of esercizio table and the csv is correct..the application work fine, but
> when I try to enter esercizio I received this error(see below the
> table)..Thanks in advance, I have no idea
>
> db.define_table('esercizio_consorzio',
>
> Field('partenza',type='date',requires=IS_DATE(str(T('%d-%m-%Y')))),
>
> Field('finale',type='date',requires=IS_DATE(str(T('%d-%m-%Y')))),
> Field('stato',type='boolean',requires=IS_NOT_EMPTY()),
> format = '%(partenza,partenza)s'
>
> )
> db.esercizio_consorzio.id.readable = False
> db.esercizio_consorzio.id.writable = False
>
>
>
> db.define_table('esercizio',
> Field('inviato',type='boolean',requires=IS_NOT_EMPTY()),
> Field('user_id','reference
> auth_user',requires=IS_NOT_EMPTY(),readable=False,writable=False),
> Field('esercizio_consorzio','reference
> esercizio_consorzio',requires=IS_NOT_EMPTY(),readable=False,writable=False),
>
> )
> db.esercizio_consorzio.id.readable = False
> db.esercizio_consorzio.id.writable = False
>
> Traceback (most recent call last):
> File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
> File "/home/www-data/web2py/applications/coop/views/appadmin.html"
> <https://136.243.247.71/admin/default/edit/coop/views/appadmin.html>, line
> 191, in <module>
> {{pass}}
> File "/home/www-data/web2py/gluon/sqlhtml.py", line 3252, in __init__
> r = A(represent(field, r, record), _href=str(href))
> File "/home/www-data/web2py/gluon/sqlhtml.py", line 68, in represent
> return f(value)
> File "/home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py",
> line 265, in __call__
> return value if value is None else _fieldformat(self.ref, value)
> File "/home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py",
> line 253, in _fieldformat
> return r._format % row
> File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 76,
> in __getitem__
> raise KeyError
> KeyError
>
>
>
--
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.