mirror of https://github.com/snachodog/mybuddy.git
parent
9d2e539fc4
commit
e2779c006f
|
@ -38,6 +38,15 @@ class BabyBuddyFilterView(FilterView):
|
||||||
# TODO Figure out the correct way to use this.
|
# TODO Figure out the correct way to use this.
|
||||||
strict = False
|
strict = False
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
children = {
|
||||||
|
o.child for o in context['object_list'] if hasattr(o, "child")
|
||||||
|
}
|
||||||
|
if len(children) == 1:
|
||||||
|
context['unique_child'] = True
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class UserList(StaffOnlyMixin, BabyBuddyFilterView):
|
class UserList(StaffOnlyMixin, BabyBuddyFilterView):
|
||||||
model = User
|
model = User
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
<thead class="thead-inverse">
|
<thead class="thead-inverse">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Time" %}</th>
|
<th>{% trans "Time" %}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<th>{% trans "Child" %}</th>
|
<th>{% trans "Child" %}</th>
|
||||||
|
{% endif %}
|
||||||
<th class="text-center">{% trans "Contents" %}</th>
|
<th class="text-center">{% trans "Contents" %}</th>
|
||||||
<th>{% trans "Color" %}</th>
|
<th>{% trans "Color" %}</th>
|
||||||
<th>{% trans "Amount" %}</th>
|
<th>{% trans "Amount" %}</th>
|
||||||
|
@ -34,7 +36,9 @@
|
||||||
{% cycle "odd" "even" as row_class silent %}
|
{% cycle "odd" "even" as row_class silent %}
|
||||||
<tr class="{{ row_class }}">
|
<tr class="{{ row_class }}">
|
||||||
<th scope="row">{{ change.time|datetime_short }}</th>
|
<th scope="row">{{ change.time|datetime_short }}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<td><a href="{% url 'core:child' change.child.slug %}">{{ change.child }}</a></td>
|
<td><a href="{% url 'core:child' change.child.slug %}">{{ change.child }}</a></td>
|
||||||
|
{% endif %}
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
{% if change.wet %}<span title="{% trans "Wet" %}">💦</span>{% endif %}
|
{% if change.wet %}<span title="{% trans "Wet" %}">💦</span>{% endif %}
|
||||||
{% if change.solid %}<span title="{% trans "Solid" %}">💩</span>{% endif %}
|
{% if change.solid %}<span title="{% trans "Solid" %}">💩</span>{% endif %}
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
<thead class="thead-inverse">
|
<thead class="thead-inverse">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Date" %}</th>
|
<th>{% trans "Date" %}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<th>{% trans "Child" %}</th>
|
<th>{% trans "Child" %}</th>
|
||||||
|
{% endif %}
|
||||||
<th>{% trans "Method" %}</th>
|
<th>{% trans "Method" %}</th>
|
||||||
<th>{% trans "Type" %}</th>
|
<th>{% trans "Type" %}</th>
|
||||||
{% comment %}Abbreviation of "Amount"{% endcomment %}
|
{% comment %}Abbreviation of "Amount"{% endcomment %}
|
||||||
|
@ -36,7 +38,9 @@
|
||||||
{% cycle "odd" "even" as row_class silent %}
|
{% cycle "odd" "even" as row_class silent %}
|
||||||
<tr class="{{ row_class }}">
|
<tr class="{{ row_class }}">
|
||||||
<th scope="row">{{ feeding.start|datetime_short }}</th>
|
<th scope="row">{{ feeding.start|datetime_short }}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<td><a href="{% url 'core:child' feeding.child.slug %}">{{ feeding.child }}</a></td>
|
<td><a href="{% url 'core:child' feeding.child.slug %}">{{ feeding.child }}</a></td>
|
||||||
|
{% endif %}
|
||||||
<td>{{ feeding.get_method_display }}</td>
|
<td>{{ feeding.get_method_display }}</td>
|
||||||
<td>{{ feeding.get_type_display }}</td>
|
<td>{{ feeding.get_type_display }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
<thead class="thead-inverse">
|
<thead class="thead-inverse">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Time" %}</th>
|
<th>{% trans "Time" %}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<th>{% trans "Child" %}</th>
|
<th>{% trans "Child" %}</th>
|
||||||
|
{% endif %}
|
||||||
<th>{% trans "Note" %}</th>
|
<th>{% trans "Note" %}</th>
|
||||||
<th class="text-center">{% trans "Actions" %}</th>
|
<th class="text-center">{% trans "Actions" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -31,7 +33,9 @@
|
||||||
{% for note in object_list %}
|
{% for note in object_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ note.time|datetime_short }}</th>
|
<th scope="row">{{ note.time|datetime_short }}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<td><a href="{% url 'core:child' note.child.slug %}">{{ note.child }}</a></td>
|
<td><a href="{% url 'core:child' note.child.slug %}">{{ note.child }}</a></td>
|
||||||
|
{% endif %}
|
||||||
<td>{{ note.note }}</td>
|
<td>{{ note.note }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
|
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Start" %}</th>
|
<th>{% trans "Start" %}</th>
|
||||||
<th>{% trans "End" %}</th>
|
<th>{% trans "End" %}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<th>{% trans "Child" %}</th>
|
<th>{% trans "Child" %}</th>
|
||||||
|
{% endif %}
|
||||||
<th>{% trans "Duration" %}</th>
|
<th>{% trans "Duration" %}</th>
|
||||||
<th class="text-center">{% trans "Nap" %}</th>
|
<th class="text-center">{% trans "Nap" %}</th>
|
||||||
<th class="text-center">{% trans "Actions" %}</th>
|
<th class="text-center">{% trans "Actions" %}</th>
|
||||||
|
@ -35,7 +37,9 @@
|
||||||
<tr class="{{ row_class }}">
|
<tr class="{{ row_class }}">
|
||||||
<th scope="row">{{ sleep.start|datetime_short }}</th>
|
<th scope="row">{{ sleep.start|datetime_short }}</th>
|
||||||
<td>{{ sleep.end|datetime_short }}</td>
|
<td>{{ sleep.end|datetime_short }}</td>
|
||||||
|
{% if not unique_child %}
|
||||||
<td><a href="{% url 'core:child' sleep.child.slug %}">{{ sleep.child }}</a></td>
|
<td><a href="{% url 'core:child' sleep.child.slug %}">{{ sleep.child }}</a></td>
|
||||||
|
{% endif %}
|
||||||
<td>{{ sleep.duration|duration_string }}</td>
|
<td>{{ sleep.duration|duration_string }}</td>
|
||||||
<td class="text-center">{{ sleep.nap|bool_icon }}</td>
|
<td class="text-center">{{ sleep.nap|bool_icon }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
<thead class="thead-inverse">
|
<thead class="thead-inverse">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Time" %}</th>
|
<th>{% trans "Time" %}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<th>{% trans "Child" %}</th>
|
<th>{% trans "Child" %}</th>
|
||||||
|
{% endif %}
|
||||||
<th>{% trans "Temperature" %}</th>
|
<th>{% trans "Temperature" %}</th>
|
||||||
<th class="text-center">{% trans "Actions" %}</th>
|
<th class="text-center">{% trans "Actions" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -32,7 +34,9 @@
|
||||||
{% cycle "odd" "even" as row_class silent %}
|
{% cycle "odd" "even" as row_class silent %}
|
||||||
<tr class="{{ row_class }}">
|
<tr class="{{ row_class }}">
|
||||||
<th scope="row">{{ temperature.time|datetime_short }}</th>
|
<th scope="row">{{ temperature.time|datetime_short }}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<td><a href="{% url 'core:child' temperature.child.slug %}">{{ temperature.child }}</a></td>
|
<td><a href="{% url 'core:child' temperature.child.slug %}">{{ temperature.child }}</a></td>
|
||||||
|
{% endif %}
|
||||||
<td>{{ temperature.temperature }}</td>
|
<td>{{ temperature.temperature }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
|
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Start" %}</th>
|
<th>{% trans "Start" %}</th>
|
||||||
<th>{% trans "Name" %}</th>
|
<th>{% trans "Name" %}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<th>{% trans "Child" %}</th>
|
<th>{% trans "Child" %}</th>
|
||||||
|
{% endif %}
|
||||||
<th>{% trans "Duration" %}</th>
|
<th>{% trans "Duration" %}</th>
|
||||||
<th>{% trans "End" %}</th>
|
<th>{% trans "End" %}</th>
|
||||||
<th>{% trans "Active" %}</th>
|
<th>{% trans "Active" %}</th>
|
||||||
|
@ -35,11 +37,13 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ timer.start|datetime_short }}</th>
|
<th scope="row">{{ timer.start|datetime_short }}</th>
|
||||||
<td><a href="{% url 'core:timer-detail' timer.id %}">{{ timer }}</a></td>
|
<td><a href="{% url 'core:timer-detail' timer.id %}">{{ timer }}</a></td>
|
||||||
|
{% if not unique_child %}
|
||||||
<td>
|
<td>
|
||||||
{% if timer.child %}
|
{% if timer.child %}
|
||||||
<a href="{% url 'core:child' timer.child.slug %}">{{ timer.child }}</a>
|
<a href="{% url 'core:child' timer.child.slug %}">{{ timer.child }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
{% endif %}
|
||||||
<td>{{ timer.duration|duration_string }}</td>
|
<td>{{ timer.duration|duration_string }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if timer.end %}
|
{% if timer.end %}
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Start" %}</th>
|
<th>{% trans "Start" %}</th>
|
||||||
<th>{% trans "End" %}</th>
|
<th>{% trans "End" %}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<th>{% trans "Child" %}</th>
|
<th>{% trans "Child" %}</th>
|
||||||
|
{% endif %}
|
||||||
<th>{% trans "Duration" %}</th>
|
<th>{% trans "Duration" %}</th>
|
||||||
<th>{% trans "Milestone" %}</th>
|
<th>{% trans "Milestone" %}</th>
|
||||||
<th class="text-center">{% trans "Actions" %}</th>
|
<th class="text-center">{% trans "Actions" %}</th>
|
||||||
|
@ -33,7 +35,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ tummytime.start|datetime_short }}</th>
|
<th scope="row">{{ tummytime.start|datetime_short }}</th>
|
||||||
<td>{{ tummytime.end|datetime_short }}</td>
|
<td>{{ tummytime.end|datetime_short }}</td>
|
||||||
|
{% if not unique_child %}
|
||||||
<td><a href="{% url 'core:child' tummytime.child.slug %}">{{ tummytime.child }}</a></td>
|
<td><a href="{% url 'core:child' tummytime.child.slug %}">{{ tummytime.child }}</a></td>
|
||||||
|
{% endif %}
|
||||||
<td>{{ tummytime.duration|duration_string }}</td>
|
<td>{{ tummytime.duration|duration_string }}</td>
|
||||||
<td>{{ tummytime.milestone }}</td>
|
<td>{{ tummytime.milestone }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
<thead class="thead-inverse">
|
<thead class="thead-inverse">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Date" %}</th>
|
<th>{% trans "Date" %}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<th>{% trans "Child" %}</th>
|
<th>{% trans "Child" %}</th>
|
||||||
|
{% endif %}
|
||||||
<th>{% trans "Weight" %}</th>
|
<th>{% trans "Weight" %}</th>
|
||||||
<th class="text-center">{% trans "Actions" %}</th>
|
<th class="text-center">{% trans "Actions" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -32,7 +34,9 @@
|
||||||
{% cycle "odd" "even" as row_class silent %}
|
{% cycle "odd" "even" as row_class silent %}
|
||||||
<tr class="{{ row_class }}">
|
<tr class="{{ row_class }}">
|
||||||
<th scope="row">{{ weight.date }}</th>
|
<th scope="row">{{ weight.date }}</th>
|
||||||
|
{% if not unique_child %}
|
||||||
<td><a href="{% url 'core:child' weight.child.slug %}">{{ weight.child }}</a></td>
|
<td><a href="{% url 'core:child' weight.child.slug %}">{{ weight.child }}</a></td>
|
||||||
|
{% endif %}
|
||||||
<td>{{ weight.weight }}</td>
|
<td>{{ weight.weight }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
|
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
|
||||||
|
|
Loading…
Reference in New Issue