We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to code a link tag which creates a complete url link.
link
{% link "page" my-page %}
is supposed to create
page title
But I don't know how to access to viewsin the code of the tag:
views
@register.simple_tag(name='link') def tag_link(*args): views = ??? view_name, inst = args url = add_url_path_component("/", views[view_name].reverse_url(inst) ) (...)
The text was updated successfully, but these errors were encountered:
Would this do something that the url tag wouldn't? See the wiki here. The usage is a little different to what you're trying to achieve, however.
url
Usage (for example, when iterating through pages):
{% for page in pages %} <a href="{% url "pages-view-name", page.pk %}">{{ page.title }}</a>. {% endfor %}
See the code for the extension here.
Sorry, something went wrong.
Well, I was playing around with the code...
My idea is to have some sort of macro to cite quickly a page. Essentially, to obtain the result of
<a href="{% url "pages-view-name", page.pk %}">{{ page.title }}</a>.
in one command.
No branches or pull requests
I'm trying to code a
link
tag which creates a complete url link.is supposed to create
page title
But I don't know how to access to
views
in the code of the tag:The text was updated successfully, but these errors were encountered: