mirror of https://github.com/snachodog/mybuddy.git
Add filtering to existing list pages.
This commit is contained in:
parent
7b6c9fb3f3
commit
2da699c042
|
@ -0,0 +1,20 @@
|
|||
{% load widget_tweaks %}
|
||||
|
||||
<form role="form" action="" method="get">
|
||||
<div class="form-group form-row">
|
||||
{% for field in filter.form %}
|
||||
<label for="id_{{ field.name }}" class="col-xs-2 col-sm-auto col-form-label col-form-label-sm">
|
||||
{{ field.label }}
|
||||
</label>
|
||||
<div class="col-xs-10 col-sm-auto">
|
||||
{{ field|add_class:"form-control form-control-sm" }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="col-xs-12 col-sm-auto">
|
||||
<button type="submit" class="btn btn-sm btn-primary">Filter</button>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-auto">
|
||||
<a href="{{ request.path }}" class="btn btn-sm btn-dark">Reset</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
{% block content %}
|
||||
<h1>Children</h1>
|
||||
{% include 'babybuddy/filter.html' %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
|
@ -50,9 +51,8 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
</div>
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
|
||||
{% if perms.core.add_child %}
|
||||
<a href="{% url 'child-add' %}" class="btn btn-sm btn-success">
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
{% block content %}
|
||||
<h1>Diaper Changes</h1>
|
||||
{% include 'babybuddy/filter.html' %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
|
@ -55,9 +56,8 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
</div>
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
|
||||
{% if perms.core.add_diaperchange %}
|
||||
<a href="{% url 'diaperchange-add' %}" class="btn btn-sm btn-success">
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
{% block content %}
|
||||
<h1>Feedings</h1>
|
||||
{% include 'babybuddy/filter.html' %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
|
@ -61,9 +62,8 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
</div>
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
|
||||
{% if perms.core.add_feeding %}
|
||||
<a href="{% url 'feeding-add' %}" class="btn btn-sm btn-success">
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
{% block content %}
|
||||
<h1>Notes</h1>
|
||||
{% include 'babybuddy/filter.html' %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
|
@ -50,9 +51,8 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
</div>
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
|
||||
{% if perms.core.add_note %}
|
||||
<a href="{% url 'note-add' %}" class="btn btn-sm btn-success">
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
{% block content %}
|
||||
<h1>Sleep</h1>
|
||||
{% include 'babybuddy/filter.html' %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
|
@ -53,9 +54,8 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
</div>
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
|
||||
{% if perms.core.add_sleep %}
|
||||
<a href="{% url 'sleep-add' %}" class="btn btn-sm btn-success">
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
{% block content %}
|
||||
<h1>Timers</h1>
|
||||
{% include 'babybuddy/filter.html' %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
|
@ -38,7 +39,6 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
</div>
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
{% endblock %}
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
{% block content %}
|
||||
<h1>Tummy Time</h1>
|
||||
{% include 'babybuddy/filter.html' %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
|
@ -55,9 +56,8 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
</div>
|
||||
{% include 'babybuddy/paginator.html' %}
|
||||
|
||||
{% if perms.core.add_tummytime %}
|
||||
<a href="{% url 'tummytime-add' %}" class="btn btn-sm btn-success">
|
||||
|
|
|
@ -19,6 +19,7 @@ class ChildList(PermissionRequiredMixin, FilterView):
|
|||
template_name = 'core/child_list.html'
|
||||
permission_required = ('core.view_child',)
|
||||
paginate_by = 10
|
||||
filter_fields = ('first_name', 'last_name')
|
||||
|
||||
|
||||
class ChildAdd(PermissionRequiredMixin, CreateView):
|
||||
|
@ -53,6 +54,7 @@ class DiaperChangeList(PermissionRequiredMixin, FilterView):
|
|||
template_name = 'core/diaperchange_list.html'
|
||||
permission_required = ('core.view_diaperchange',)
|
||||
paginate_by = 10
|
||||
filter_fields = ('child', 'wet', 'solid', 'color')
|
||||
|
||||
|
||||
class DiaperChangeAdd(PermissionRequiredMixin, CreateView):
|
||||
|
@ -80,6 +82,7 @@ class FeedingList(PermissionRequiredMixin, FilterView):
|
|||
template_name = 'core/feeding_list.html'
|
||||
permission_required = ('core.view_feeding',)
|
||||
paginate_by = 10
|
||||
filter_fields = ('child', 'type', 'method')
|
||||
|
||||
|
||||
class FeedingAdd(PermissionRequiredMixin, CreateView):
|
||||
|
@ -113,6 +116,7 @@ class NoteList(PermissionRequiredMixin, FilterView):
|
|||
template_name = 'core/note_list.html'
|
||||
permission_required = ('core.view_note',)
|
||||
paginate_by = 10
|
||||
filter_fields = ('child',)
|
||||
|
||||
|
||||
class NoteAdd(PermissionRequiredMixin, CreateView):
|
||||
|
@ -140,6 +144,7 @@ class SleepList(PermissionRequiredMixin, FilterView):
|
|||
template_name = 'core/sleep_list.html'
|
||||
permission_required = ('core.view_sleep',)
|
||||
paginate_by = 10
|
||||
filter_fields = ('child',)
|
||||
|
||||
|
||||
class SleepAdd(PermissionRequiredMixin, CreateView):
|
||||
|
@ -173,6 +178,7 @@ class TimerList(PermissionRequiredMixin, FilterView):
|
|||
template_name = 'core/timer_list.html'
|
||||
permission_required = ('core.view_timer',)
|
||||
paginate_by = 10
|
||||
filter_fields = ('active', 'user')
|
||||
|
||||
|
||||
class TimerDetail(PermissionRequiredMixin, DetailView):
|
||||
|
@ -254,6 +260,7 @@ class TummyTimeList(PermissionRequiredMixin, FilterView):
|
|||
template_name = 'core/tummytime_list.html'
|
||||
permission_required = ('core.view_tummytime',)
|
||||
paginate_by = 10
|
||||
filter_fields = ('child',)
|
||||
|
||||
|
||||
class TummyTimeAdd(PermissionRequiredMixin, CreateView):
|
||||
|
|
Loading…
Reference in New Issue