Re: Any way to select which Model to initialize without resorting to "if-elfi" statements?

2010-10-03 Thread Michael
You can always pre-define them all in a dict: cat2form = {'TV': TVForm, 'Laptop': LaptopForm} model_form = cat2form[category] model_form_instance = model_form() This way you forms don't have to follow a strict naming convention. -- Michael On Sun, 2010-10-03 at 01:04

Re: Any way to select which Model to initialize without resorting to "if-elfi" statements?

2010-10-03 Thread Steve Holden
On 10/3/2010 4:04 AM, Andy wrote: > I need to model many different product categories such as TV, laptops, > women's apparel, men's shoes, etc. > > Since different product categories have different product attributes, > each category has its own separate Model: TV, Laptop, WomensApparel, >

Any way to select which Model to initialize without resorting to "if-elfi" statements?

2010-10-03 Thread Andy
I need to model many different product categories such as TV, laptops, women's apparel, men's shoes, etc. Since different product categories have different product attributes, each category has its own separate Model: TV, Laptop, WomensApparel, MensShoes, etc. And for each Model I created a