Hello,

I'm trying to develop a simple hyperlink between two pages. It sounds 
simple but it's a little bit more complex then that.

Here is the template code that proceeds through the database of 
contributors:

<center><u>Contributors</u></center>

<ol>
{% for Contributor in Contributors_List %}
    <li><a href="http://www.madtrak.com/about/contributors/";>{{ 
Contributor.name }}</a></li>
<ul>
<li>Title: {{ Contributor.title }}</li>
</ul>
{% endfor %}
</ol>

and spits out the contributors name in a link form and the title of that 
person.

My problem is that I want each contributor to have their own separate page. 
So if the first guys name for some example is Mike Smith then if you were 
to click his name for example you would be sent to 
/about/contributor/mikesmith and so on. I supposed I could define a url for 
each contributor so I could set this up:

<center><u>Contributors</u></center>

<ol>
{% for Contributor in Contributors_List %}
    <li><a href="{{ Contributor.link">{{ Contributor.name }}</a></li>
<ul>
<li>Title: {{ Contributor.title }}</li>
</ul>
{% endfor %}
</ol>

but that doesn't seem like the correct way to do this. that 
Contributor.link is then hardcoded into the system. It's not generated by 
the system obviously.

I also have:

def mikesmith(request):
    mikesmith = Contributor.objects.filter(name='Mike Smith')
    return render_to_response('mikesmith.html', {'Contributor': mikesmith}, 
context_instance = RequestContext(request))

I have that repeated for each and every contributor. This goes againist 
Django's DRY mentality so I have a feeling there is a much better way.

Thanks,

JJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/xWx39cCFzvYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to