Re: 'Latest' foreign key template filter?

2009-03-02 Thread Allfonso
Aha, Found solution myself. Any newbies trying to pull the latest item of anything... under your model definition, set a meta class with the following: class Meta: get_latest_by = "some_datefield" Then in your template simply use something like the following: {{

'Latest' foreign key template filter?

2009-03-02 Thread Alfonso
I'm trying to pull the latest foreign key selling price value for a particular product in the database. At the moment I am grabbing them all just by doing: {% for price in product.product_sell_price.all %} {{ price.unit_price }} {% endfor %} but what I want to do is just pull the latest one