views:

57

answers:

2

i have an application, and in my urls.py i have something like that:

      urlpatterns = patterns('',
                    url(r'^profile_view/(?P<id>\d+)/$', 
                       profile_view,
                       name='profile_view'),)

meaning that the profile_view function has id as a parameter. Now, i want to call that function from my template, using a link like Reply

The problem is that i don't know how to use the above url as a link, meaning how can i 'pass the id parameter to a link'? thank you

+1  A: 

edit:

In your template you should have an object available via your view that holds all of the ids to your blog posts. Then you would simply loop through those to display links for each

{% for entry in blog_list %}
    <a href="yoururl.com/profile_view/{{ entry.id }}">{{ entry.name }}</a>
{% endfor %}
Justin
yes. i'm asking how the url look like, i mean i need it like /profile_view/id/ i need it to be the same for every post of my blog.
dana
yes. work perfectly. thanks a lot!
dana
+2  A: 

Assuming this is closely linked to your other questions :o) ...

In your 'post' template, you'll want a link to your 'reply' view probably using the url tag. You should have the id of the current post in that template already passed in from the profile view? Something like:

<a href="{% url save_reply post_id %}">Reply</a>
pycruft
wow, can i use tags in links? it's amazing. makes sense, i'll try it now. thanks!
dana