1) Post created in a particular category. - 
http://hostname/app/default/created_ad/<category>

2)The category tied subcategories.

How to make that SQLFORM display only radio button of equal sub categories. 
Not show subcategories not belong to this category.

<https://lh6.googleusercontent.com/-1fPHpZIZWus/U7Un7A7o-7I/AAAAAAAAGUM/ARW_lvfxgyw/s1600/web2py.png>


def get_category():
    category_url_name = request.args(0)
    category = db.category(url_name=category_url_name)
    if not category:
        session.flash = 'page not fount'
        redirect(URL('index'))
    return category

def created_ad():
    category = get_category()
    db.ad_post.category.default = category.id
   * form = SQLFORM(db.ad_post).process(next='view_post/[id]')*
    return locals()


db.define_table('ad_post',
                Field('category', 'reference category'),
               * Field('subcategory', 'reference subcategory', 
widget=SQLFORM.widgets.radio.widget,*
*                      requires=IS_IN_DB(db, db.subcategory.id, 
label='db.category.name')),*
                Field('title', type='string', requires=IS_NOT_EMPTY()),
                Field('body', type='text', requires=IS_NOT_EMPTY()),
                auth.signature
)

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