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 %}
  <p>{{ price.unit_price }}</p>
{% endfor %}

but what I want to do is just pull the latest one (some products have
a selling price history), so can I do something like:

{% for price in product.product_sell_price.latest %}
  <p>{{ price.unit_price }}</p>
{% endfor %}

Obviously that doesn't work but wondering whether the easiest route is
to create a template tag or am I missing a built-in filter that can do
the magic for me.

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

Reply via email to