Hi everyone,
In my Django project I’ve on the front page a table where I wish to
load the two newest messages. Then I’ve a link to a message archive
where all messages are listed.
My problem is that I don’t know how to “filter” my list at my front
page so it only extracts the two newest messages
On Nov 5, 11:34 am, Bobo <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> In my Django project I’ve on the front page a table where I wish to
> load the two newest messages. Then I’ve a link to a message archive
> where all messages are listed.
>
> My problem is that I don’t know how to “filter” my l
On Wed, Nov 5, 2008 at 6:34 PM, Bobo <[EMAIL PROTECTED]> wrote:
> In my Django project I've on the front page a table where I wish to
> load the two newest messages. Then I've a link to a message archive
> where all messages are listed.
>
> My problem is that I don't know how to "filter" my list a
I would guess that this version:
messages = Message.objects.order_by('-created')[:2]
would be more memory efficient than the:
messages = Message.objects.all()
(and then using |slice:":2" to cut out the top 2)
although, I've done that second one often.
-- joe
On Nov 5, 6:56 am, "Ro
On Wed, Nov 5, 2008 at 8:23 PM, JoeJ <[EMAIL PROTECTED]> wrote:
> I would guess that this version:
> messages = Message.objects.order_by('-created')[:2]
>
> would be more memory efficient than the:
> messages = Message.objects.all()
> (and then using |slice:":2" to cut out the top 2)
>
> a
5 matches
Mail list logo