I've got an ecommerce system I'm working on.  I have a product model,
and a productattribute model tied to each product for flexibility -
such a wide variety of products can/will be sold that it wouldn't be
possible or practical to put them all on the product model.  Where
this becomes a difficulty is on the generic view list of products - I
can't find a way to get to the attributes from a template.  My first
thought was a method that would return whatever attribute I called for
(templates will be site specific, but each site focuses on different
kinds of products - so one site may have "brightness" as a primary
attribute, another "channels", etc.) but that won't work because of
keeping logic out of templates.  I'm fine with that, so my next
thought was to build a dictionary of every attribute of a product and
reference that, but {{ object.attributes["brightness"] }} gets me a
"Could not parse the remainder" error.

The only two options I see left are a template tag of called like:
productattribute object "brightness" or add attributes for everything
to the product model (and that would simply be ridiculous, in my
opinion)

What's the solution I'm missing here?  And/or how can I access
elements of a dictionary that is itself an attribute?  That feels like
the holy grail solution to me.

Thanks,
Adam


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to