Can I use alias field names in django templates? -


I'm new to the deegago and dragon ...

I have a model that includes 10 generic Attrib_00 field through attrib_09

I pass these areas as a reference to a DJ ango template string.

I would like to use more meaningful names in the template.

The template string has been derived from any other model and I have a field that contains a comma-delimited list of related alpha names, the idea to be the first surname in the list maps for Attrib_00, attrib_01 for second ...

I think the context needs to be modified before referencing so that the general key is replaced with the alias.

Am I on the right track?

Is there any better way?

Thanks, ed

PS

(the comment button is not working for me?)

I have no one yet I do not have code, maybe I should understand what I am trying to achieve ...

I have an existing application that has been written in Delphi, which helps me maintain a large number of eBay listings. And I do it in the Django / Python Web App.

Each product / listing is related to a category and each category has a set of attributes. So for example, trousers can have colors, waist_graphs and leg_lanthhams. Number and type of properties are different for each category, but never exceed 10.

I can see how attrib_00 can be used for size in a category for example, and in others the metal can be called but then it will be stuck using the generic field name in the template.

Just for information: - I think before getting the feedback, will I have any loopholes in the scene with multiple calls for the rendering process?

I will say in the surname context before going to the template from the scene.

  c = References It can plug in a new function so you can not break dry and you want to move forward.  

Update:
As far as the template is not so much template, after all, there is only one template you are thinking like coming closer to work The only thing that can be with {% with%} block:

  {% with attrib_01 as foo%} & lt; Div class = "foo" & gt; {{Foo}} & lt; / Div & gt; {% Endwith%}  

This will probably work, but I'm afraid it can be ugly.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -