Finally, I see only 3 ways: 1. copy/paste archive index code and change it's behaviour so it can eat num_latest=None 2. patch date_based.py in same way as (1) 3. use list_detail.object_list Since 1-2 are dirty, I would recommend 3rd way. I'll let you know if I could suggest something else :)
2009/10/19 tezro <tezro...@gmail.com> > > Surely I could use the list_detail.object_list, but the use of date > based generics though )) > > > On Oct 18, 11:45 pm, Михаил Лукин <mihail.lu...@googlemail.com> wrote: > > Sorry, didn't look at condition well...:( > > > > So, you see the source and you see that there's no way to get all the > > records with this view. > > Why don't you use list_detail.object_list view? If you need just to order > > list by date, you can use ordering on the model level: > http://docs.djangoproject.com/en/dev/ref/models/options/#ordering > > > > 2009/10/18 tezro <tezro...@gmail.com> > > > > > > > > > > > > > Would it? If "latest=None" doesn't it mean that there are no entries? > > > > > By the way, if I pass None to the condition, it returns False, so > > > latest is None. > > > > > Or isn't it? > > > > > Also the template cannot render it, cause "object of type 'NoneType' > > > has no len()". > > > > > Anyways, thanks for reply :) > > > > > On Oct 18, 11:04 pm, Mihail Lukin <mihail.lu...@googlemail.com> wrote: > > > > Look at date_based.py: > > > > > > if date_list and num_latest: > > > > latest = queryset.order_by('-'+date_field)[:num_latest] > > > > else: > > > > latest = None > > > > > > So, if you use num_latest=None, you will always get the whole list. > > > > > > On Aug 30, 2:47 pm, tezro <tezro...@gmail.com> wrote: > > > > > > > Anyone? > > > > > > > On Aug 14, 8:29 am, tezro <tezro...@gmail.com> wrote: > > > > > > > > The question is that > > > "django.views.generic.date_based.archive_index()" > > > > > > takes an optional argument "num_latest" which is 15 by default. > > > > > > Setting it manually to num_latest=1000000000 is way off to > correct to > > > > > > me. It works. I suppose that it even doesn't retrieve all the > tons of > > > > > > data from the DB, but what if I have 1000000000 + 1 record :) > > > > > > > > What's the right way to use "django-pagination" and the > > > "archive_index > > > > > > ()" or am I missing something? > > > > > > > > Example code. > > > > > > _______________ > > > > > > > > def index(request): > > > > > > qs = News.objects.filter(is_published=1) > > > > > > return archive_index(request, qs, 'date', > > > num_latest=100000000) > > > > > > _______________ > > > > > > > > Thanks. > > > > -- > > regards, > > Mihail > > > -- regards, Mihail --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---