Django allows you to reconstruct urls with the reverse() function and {% 
url %} template tag. You can reverse the url for a view by passing the view 
function itself, but this is not very practical. By setting a name for a 
view, you can reverse the url by referencing this name instead. This allows 
you to easily construct links to other pages on your site. For example, if 
question is an instance of your Question model, you can link to it in a 
template like this:

<a href="{% url 'detail' question_id=question.id %}">{{ question.title }}
</a>

The {% url %} tag will generate a link to the 'detail' view for this 
question. 

On Sunday, December 13, 2015 at 6:45:31 PM UTC+1, krmane wrote:
>
> hello all, 
> I was going through the basic tutorial for django 1.8 
> I see in the 3rd part on views this line. 
> url(r'^(?P<question_id>[0-9]+)/$', views.details, name='detail'), 
> I have not understood the name = 'details' part? 
> is 'details' a parameter that will have a input value? 
> I am confused because we have already associated the views.detail 
> function to the root. 
> Can some one explain? 
> happy hacking. 
> Krishnakant. 
>

-- 
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+unsubscr...@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/bdec2e3e-5bb5-49d3-b71d-26e20f43f5a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to