Oh you want just one record per page? Thats easy.
urls.py
(r'^page/(?P<page_number>\d+)/$', 'data.views.pagelisting'),
views.py
def pagelisting(request, page_number):
data_list = Data.objects.filter(pk=page_number)
return render_to_response('list.html', {"data_list": data_list})
template list.html
{% if datalist %}
<ul>
{% for data in datalist %}
<p>{{ data.text }}</p>
{% endfor %}
</ul>
<a href='http://testsite.com/page/{%pk + 1%}>Next Page<a/>
<a href='http://testsite.com/page/{%pk - 1%}>Next Page<a/>
{% else %}
<p>No data is available.</p>
{% endif %}
On Oct 15, 6:43 am, David <[email protected]> wrote:
> Hi Devin
>
> Thank you for your reply.
>
> I'm not sure if I've explained myself properly, or if I'm
> misinterpreting your reply. What I am aiming for is a form containing
> a single record. At the bottom of this form will be the pagination
> tools << Prev 1 2 3 etc. which will enable the user to navigate
> through the records individually in my form. I was hoping that the
> pagination had the ability to know the current records primary key so
> that I could render the form with a simple Data.objects.get(pk=1) this
> would then achieve the desired effect (I think).
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.