On Sun, 2006-10-01 at 17:28 +0000, keukaman wrote:
> I'm using generic views to display a list of news headlines. I use {%
> for object in latest %} in my template to show a listing of my
> headlines.

So it sounds like you are using the date-based generic views and, since
you are using "latest", you are using the archive_index() view function
in particular.

> 
> I have a couple of questions for anyone who may have a few minutes to
> explain:
> 
> 1. What entries are pulled by "latest"? I have 20 entries and the
> oldest 5 are the only ones not showing up.

The documentation for the archive_index() view is here:
http://www.djangoproject.com/documentation/generic_views/#django-views-generic-date-based-archive-index

You can see that it takes a "num_latest" parameter that defaults to 15.
If you want more or less than 15 items, pass in a different value for
that parameter (it becomes another entry in the dictionary you pass in
your URL configuration file, as per the example at the top of that
page).

> 2. Is there a "for" statement using generic views that will pull all of
> my headlines?

Try the list_detail.object_list() view. It is no longer date based
(which makes sense, because you want to control the set of results in
some other way). The queryset you pass into that view will be the one
that extracts all of your headlines. Maybe something like
Headlines.objects.all().

> 3. Are there any examples of code that show pagination that a python
> lightweight (me) could easily program?

In the list_detail.* views, pagination is built in; see the
documentation for generic views for an explanation of the controlling
parameters.

There is no pagination for date-based generic views at the moment.
Ticket #2367 is an enhancement request to add pagination to date-based
views and will probably go in at some point. At the moment we're more
focused on bug fixing than adding enhancements, so it won't be going in
immediately, but the ticket has some merit, so it hasn't been closed as
"wontfix".

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to