diff --git a/dashboard/templates/cards/feeding_last_method.html b/dashboard/templates/cards/feeding_last_method.html
index 404a1e2d..d0f872b8 100644
--- a/dashboard/templates/cards/feeding_last_method.html
+++ b/dashboard/templates/cards/feeding_last_method.html
@@ -4,9 +4,35 @@
{% block header %}{% trans "Last Feeding Method" %}{% endblock %}
{% block title %}
- {% if feeding %}
-
{{ feeding.get_method_display }}
+ {% if feedings|length > 0 %}
+
+
+ {% for feeding in feedings %}
+
+
{{ feeding.get_method_display }}
+
+ {% if forloop.last %}
+ {% trans "most recent" %}
+ {% else %}
+ {% blocktrans trimmed with n=forloop.revcounter0 plural=forloop.revcounter0|pluralize %}
+ {{ n }} feeding{{ plural }} ago
+ {% endblocktrans %}
+ {% endif %}
+
+
+ {% endfor %}
+
+
+
+ {% trans "Previous" %}
+
+
+
+ {% trans "Next" %}
+
+
{% else %}
{% trans "None" %}
{% endif %}
+
{% endblock %}
\ No newline at end of file
diff --git a/dashboard/templatetags/cards.py b/dashboard/templatetags/cards.py
index c91ef082..3f4d71b6 100644
--- a/dashboard/templatetags/cards.py
+++ b/dashboard/templatetags/cards.py
@@ -79,13 +79,14 @@ def card_feeding_last(child):
@register.inclusion_tag('cards/feeding_last_method.html')
def card_feeding_last_method(child):
"""
- Information about the most recent feeding method.
+ Information about the three most recent feeding methods.
:param child: an instance of the Child model.
- :returns: a dictionary with the most recent Feeding instance.
+ :returns: a dictionary with the most recent Feeding instances.
"""
- instance = models.Feeding.objects.filter(child=child) \
- .order_by('-end').first()
- return {'type': 'feeding', 'feeding': instance}
+ instances = models.Feeding.objects.filter(child=child) \
+ .order_by('-end')[:3]
+ # Results are reversed for carousel forward/back behavior.
+ return {'type': 'feeding', 'feedings': list(reversed(instances))}
@register.inclusion_tag('cards/sleep_last.html')
diff --git a/dashboard/tests/tests_templatetags.py b/dashboard/tests/tests_templatetags.py
index e272d085..3b8a8867 100644
--- a/dashboard/tests/tests_templatetags.py
+++ b/dashboard/tests/tests_templatetags.py
@@ -53,11 +53,13 @@ class TemplateTagsTestCase(TestCase):
self.assertEqual(data['feeding'], models.Feeding.objects.first())
def test_card_feeding_last_method(self):
- data = cards.card_feeding_last(self.child)
+ data = cards.card_feeding_last_method(self.child)
self.assertEqual(data['type'], 'feeding')
- self.assertIsInstance(data['feeding'], models.Feeding)
+ self.assertEqual(len(data['feedings']), 3)
+ for feeding in data['feedings']:
+ self.assertIsInstance(feeding, models.Feeding)
self.assertEqual(
- data['feeding'].method,
+ data['feedings'][2].method,
models.Feeding.objects.first().method)
def test_card_sleep_last(self):