PB with tag_widget

1 view
Skip to first unread message

JessiHash

unread,
Nov 4, 2008, 4:50:28 PM11/4/08
to web2py Web Framework
Hello and thank you for this wonderful piece of software

I' trying to use T2 and i have a problem with the tag_widget.

here is my code :

db.define_table('news',
SQLField('title', required=True),
SQLField('slug', default=''),
SQLField('date', 'date', default=datetime.date.today()),
SQLField('link'),
SQLField('text', 'text'),
SQLField('tags'),
SQLField('picture','upload'),
SQLField('created_by_ip'),
SQLField('created_on','datetime'),
SQLField('created_signature'),
SQLField('modified_by_ip'),
SQLField('modified_on','datetime'),
SQLField('modified_signature')
)

db.news.slug.requires=SLUG()
db.news.link.requires=IS_URL()
db.news.tags.widget=t2.tag_widget(db.news.tags,['news'])
db.news.represent=lambda row: A(row.title+" posted on
"+str(row.date),_href=t2.action('display_news', [row.id]))

display_new is just a t2.create with a t2.itemize

And i got this :

Traceback (most recent call last):
File "/home/jessihash/Bureau/web2py/gluon/restricted.py", line 62,
in restricted
exec ccode in environment
File "/home/jessihash/Bureau/web2py/applications/bhi37/controllers/
siteadmin.py", line 52, in <module>
File "/home/jessihash/Bureau/web2py/gluon/globals.py", line 55, in
<lambda>
self._caller=lambda f: f()
File "/home/jessihash/Bureau/web2py/applications/plugin_t2/modules/
t2.py", line 855, in h
return f(*a,**b)
File "/home/jessihash/Bureau/web2py/applications/bhi37/controllers/
siteadmin.py", line 38, in create_news
create=t2.create(db.news)
File "/home/jessihash/Bureau/web2py/applications/plugin_t2/modules/
t2.py", line 373, in create
showid=False,col3=col3,_class='t2-create')
File "/home/jessihash/Bureau/web2py/gluon/sqlhtml.py", line 89, in
__init__
inp=field.widget(field,default)
TypeError: 'DIV' object is not callable

with T2.display i don't have any error.

mdipierro

unread,
Nov 4, 2008, 4:57:29 PM11/4/08
to web2py Web Framework
db.news.tags.widget=t2.tag_widget(db.news.tags,['news'])

should be

db.news.tags.widget=lambda a,b:t2.tag_widget(a,b,['news'])

A widget is a function that takes a field and its value.

JessiHash

unread,
Nov 5, 2008, 7:09:24 AM11/5/08
to web2py Web Framework
Thank you

It works !!!! (yes i can ;-) )
Reply all
Reply to author
Forward
0 new messages