Add tags to the list view and the Api serializer

This commit is contained in:
Brian O'Connor 2023-01-29 09:38:54 -05:00 committed by Christopher Charbonneau Wells
parent 945e30adb9
commit 6c14590579
2 changed files with 7 additions and 3 deletions

View File

@ -121,10 +121,10 @@ class BMISerializer(CoreModelSerializer, TaggableSerializer):
} }
class PumpingSerializer(CoreModelSerializer): class PumpingSerializer(CoreModelSerializer, TaggableSerializer):
class Meta: class Meta:
model = models.Pumping model = models.Pumping
fields = ("id", "child", "amount", "time", "notes") fields = ("id", "child", "amount", "time", "notes", "tags")
class ChildSerializer(serializers.HyperlinkedModelSerializer): class ChildSerializer(serializers.HyperlinkedModelSerializer):

View File

@ -27,6 +27,7 @@
<th>{% trans "Child" %}</th> <th>{% trans "Child" %}</th>
{% endif %} {% endif %}
<th>{% trans "Amount" %}</th> <th>{% trans "Amount" %}</th>
<th>{% trans "Tags" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -55,6 +56,9 @@
<td><a href="{% url 'core:child' pumping.child.slug %}">{{ pumping.child }}</a></td> <td><a href="{% url 'core:child' pumping.child.slug %}">{{ pumping.child }}</a></td>
{% endif %} {% endif %}
<td>{{ pumping.amount }}</td> <td>{{ pumping.amount }}</td>
<td>
{% include "core/render_tag_list.html" with tags=pumping.tags.all %}
</td>
</tr> </tr>
{% if pumping.notes %} {% if pumping.notes %}
<tr class="{{ row_class }} row-details"> <tr class="{{ row_class }} row-details">
@ -70,4 +74,4 @@
</table> </table>
</div> </div>
{% include 'babybuddy/paginator.html' %} {% include 'babybuddy/paginator.html' %}
{% endblock %} {% endblock %}