0

Is it possible to use URLs like this Django -

url(r'^movie/(?P<id1>\d+)/forum/(?P<id2>\d+)/$', "movies.views.show_comments", name='comments'),

This is my view -

def show_comments(request, id1, id2):

This is the template -

<a href="{% url 'comments' object.pk f.pk %}"><h4>{{ f.topic }}</h4></a>

But when i go to the url, it doesn't call the view function, it just reloads to the same page. What am i doing wrong?

2
  • 1
    Can you show the rest of your urls.py? Commented Jan 7, 2016 at 8:42
  • I looked into the other URLs and found the mistake, thanx. Commented Jan 7, 2016 at 8:55

1 Answer 1

4

My other URL-

url(r'^movie/(?P<id>\d+)', "movies.views.show_detail", name='detail'),

was incomplete, i had to put /$ after it. So it should be like this-

url(r'^movie/(?P<id>\d+)/$', "movies.views.show_detail", name='detail'),
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.