Right now I am categorizing my products by 'category' and 'subcategory'
using smartgrid. This makes it very easy for me to log in and set my cats
and sub cats. I have two tables below.
db.define_table('cat',
Field('name'),
format = '%(name)s'
)
db.define_table('subcat',
Field('cat', 'reference cat'),
Field('name'),
format = '%(name)s'
)
I also have a third table for the product:
db.define_table('equipment',
...
Field('category', db.cat),
Field('subcategory', db.subcat, label="Sub-Category")
...
)
I am using this as my controller:
def productadmin():
fields = [db.equipment.title, db.equipment.approved]
grid = SQLFORM.grid(db.equipment, fields=fields)
return dict(grid=grid)
Here is my question.
When I click on 'edit' in the sqlform.grid for an item, and I want to
change the category or assign the category, how do I make it so only the
subcat will show if it is truly a subcat for the category? Currently, I
have a list of all my cats and a list of all my subcats.
--