Monday, May 30, 2016

Re: Reverse for 'reg/{{post.pk}}/' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

On 24/05/16 08:46, meInvent bbird wrote:
> <button type="submit" class="save btn btn-default"
> onClick="window.location.href='{% url 'reg/{{post.pk}}' %}'">Save</button>

You cannot access a variable like this in a template.
There is also no point in trying to access an url using url providing an
url. Your url pattern is called 'post_detail'.

Try something like:
{% url 'post_detail' pk=post.pk %}

More information is available in the docs:
https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#url

--
Florian

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/455b7782-d723-8bf0-0961-5e39f09ea55d%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment