On Mon, May 11, 2009 at 4:29 PM, Tom
<thomas...@gmail.com> wrote:
Thank you Michael,
Can you explain me the "Clean" way to do that ?
Sure, you create a view (or use a generic view) that calls a template and has one of your models like so:
from django.shortcuts import render_to_response
from yourapp.models import YourModel
def yourview(request):
m = YourModel.objects.order_by('?')[0]
return render_to_response('yourtemplate.html', { 'object' : m})
and your template would then have a simple link like so
<a href="{{ object.url }}">{{ object.title }}</a>
Simple. I hope that helps,
Michael