Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-21 Thread tezro

Thanks again. Did it with object_list. Thanks for help :)

On Oct 19, 2:16 pm, Михаил Лукин  wrote:
> 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 
>
>
>
>
>
> > Surely I could use the list_detail.object_list, but the use of date
> > based generics though ))
>
> > On Oct 18, 11:45 pm, Михаил Лукин  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 
>
> > > > 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  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  wrote:
>
> > > > > > Anyone?
>
> > > > > > On Aug 14, 8:29 am, tezro  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=10 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 10 + 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=1)
> > > > > > > ___
>
> > > > > > > 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
-~--~~~~--~~--~--~---



Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-19 Thread Михаил Лукин
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 

>
> Surely I could use the list_detail.object_list, but the use of date
> based generics though ))
>
>
> On Oct 18, 11:45 pm, Михаил Лукин  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 
> >
> >
> >
> >
> >
> > > 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  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  wrote:
> >
> > > > > Anyone?
> >
> > > > > On Aug 14, 8:29 am, tezro  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=10 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 10 + 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=1)
> > > > > > ___
> >
> > > > > > 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
-~--~~~~--~~--~--~---



Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-19 Thread tezro

Surely I could use the list_detail.object_list, but the use of date
based generics though ))


On Oct 18, 11:45 pm, Михаил Лукин  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 
>
>
>
>
>
> > 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  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  wrote:
>
> > > > Anyone?
>
> > > > On Aug 14, 8:29 am, tezro  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=10 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 10 + 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=1)
> > > > > ___
>
> > > > > Thanks.
>
> --
> 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
-~--~~~~--~~--~--~---



Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-18 Thread Михаил Лукин
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 

>
> 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  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  wrote:
> >
> > > Anyone?
> >
> > > On Aug 14, 8:29 am, tezro  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=10 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 10 + 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=1)
> > > > ___
> >
> > > > Thanks.
> >
> >
> >
>


-- 
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
-~--~~~~--~~--~--~---



Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-18 Thread tezro

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  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  wrote:
>
> > Anyone?
>
> > On Aug 14, 8:29 am, tezro  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=10 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 10 + 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=1)
> > > ___
>
> > > Thanks.
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-18 Thread Mihail Lukin

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  wrote:
> Anyone?
>
> On Aug 14, 8:29 am, tezro  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=10 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 10 + 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=1)
> > ___
>
> > Thanks.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: "django-pagination" and generic.views.date_based.archive_index()

2009-08-30 Thread tezro

Anyone?

On Aug 14, 8:29 am, tezro  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=10 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 10 + 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=1)
> ___
>
> Thanks.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



"django-pagination" and generic.views.date_based.archive_index()

2009-08-13 Thread tezro

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=10 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 10 + 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=1)
___

Thanks.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---