Dynamic Tags with Django Templates -
i'm new django templates , need advice.
i'm trying alter h1 depending on url path. proposed solution lookup path , cycle through array check match.
here sample array maintain in config file.
page_heading = { 'contact': 'contact me', 'test': 'it\'s test', }
so, in example, if path /contact h1 header read contact me.
so, right strategy? can't find code samples on how django templates. maybe i'm searching wrong terms. in advance help.
if it's value of heading ('contact us', 'about us') can utilize line in template >> <h1><a href="{{ heading_path }}">{{ heading_value }}</a></h1>
, in views renders template need add together variable heading_path
, heading_value
dictionary passed along requestcontext
django-templates
No comments:
Post a Comment