H
H
hardwellZero2015-04-12 16:34:42
Django
hardwellZero, 2015-04-12 16:34:42

How to handle click on submit?

Good afternoon.
There are two urls:

url(r'^test/', generate_url),
url(r'^(?P<hash>\w+)/$', load_url, name="url"),

On the first one, I generate a hash for the link, on the second, I open it.
How can I do something on the main
url
url(r'^$', TemplateView.as_view(template_name='index.html'), name='index'),

there was a link generation button. On click, call the generation view?
Thank you for your attention ;)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2015-04-12
@hardwellZero

Add name to urls:
In template:
<a href="{% url 'generate_url' %}">Клик</a>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question