5👍
✅
I would say to make your aliases in the context before passing from the view to the template. Something along the lines of:
c = Context({'foo': attrib_01, 'bar': attrib_02, ...})
You can plug this into a new function so that you don’t break DRY and you’re good to go.
Update:
As far as actually mapping this within the template, not so much. The template is, after all, just a template. The only thing coming close to working like you’re thinking is a {% with %}
block:
{% with attrib_01 as foo %}
<div class="foo">{{ foo }}</div>
{% endwith %}
It would likely work, but I fear it could get rather ugly.
0👍
How about using translations?
attrib_00 = models.TextField(_('attrib_00'), blank=True, null=True)
And then have different translations for attrib_00 as required.
- [Django]-How to add a custom field that is not present in database in graphene django
- [Django]-Null value in column "user_id" violates not-null constraint in Django 1.9
- [Django]-NoReverseMatch at / Reverse for 'single_product' with no arguments not found. 1 pattern(s) tried: ['products/(?P<slug>)/$']
- [Django]-Deep JSON Serialization of Django objects
Source:stackexchange.com