Yup, if you have non-null date/datetime fields on your model, each
model will automatically get "get_next_by_FOO" and
"get_previous_by_FOO" methods, where FOO is the name of the datetime
field:
http://docs.djangoproject.com/en/1.1/ref/models/instances/#django.db.models.Model.get_next_by_FOO
Eric
On Feb 7, 2010, at 2:34 AM, eaman wrote:
Hello, I have a quite simple query set and a related generic views:
http://dpaste.com/155494/
And template for generating a detail page of a photo.
Is there an easy way to have a link to previous | next element in the
template
without manualy coding a view ?
Somthing like a:
{% if foto.next_item %}
<a href="/path/foto/{{ fot.next_item.id_field }}/">Next</a>
{% endif}
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To post to this group, send email to django-us...@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
.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@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.