mirror of https://github.com/snachodog/mybuddy.git
Prepare for a sleep reports page.
This commit is contained in:
parent
2fdee5785b
commit
ae71c5933e
|
@ -17,9 +17,13 @@
|
||||||
aria-expanded="false"><i class="fa fa-bar-chart" aria-hidden="true"></i> Reports</button>
|
aria-expanded="false"><i class="fa fa-bar-chart" aria-hidden="true"></i> Reports</button>
|
||||||
<div class="dropdown-menu" aria-labelledby="reports-dropdown">
|
<div class="dropdown-menu" aria-labelledby="reports-dropdown">
|
||||||
{% if perms.core.view_diaperchange %}
|
{% if perms.core.view_diaperchange %}
|
||||||
<a class="dropdown-item" href="{% url 'reports:report-diaperchange' object.slug %}">
|
<a class="dropdown-item" href="{% url 'reports:report-diaperchange-child' object.slug %}">
|
||||||
<i class="fa fa-trash" aria-hidden="true"></i> Changes</a>
|
<i class="fa fa-trash" aria-hidden="true"></i> Changes</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if perms.core.view_sleep %}
|
||||||
|
<a class="dropdown-item" href="{% url 'reports:report-sleep-child' object.slug %}">
|
||||||
|
<i class="fa fa-bed" aria-hidden="true"></i> Sleep</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,12 +1,19 @@
|
||||||
{% extends 'reports/report_base.html' %}
|
{% extends 'reports/report_base.html' %}
|
||||||
|
|
||||||
{% block title %}Sleep Report - {{ object }}{% endblock %}
|
{% block title %}Sleep Reports - {{ object }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div class="jumbotron jumbotron-fluid text-center">
|
||||||
Sleep report for {{ object }}.
|
<h1 class="display-3">Sleep Reports</h1>
|
||||||
|
<h2 class="text-muted">{{ object }}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
{{ html|safe }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Test
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascript %}
|
||||||
|
{{ block.super }}
|
||||||
|
{{ javascript|safe }}
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -7,7 +7,8 @@ from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^reports/changes/(?P<slug>[^/.]+)/$',
|
url(r'^reports/changes/(?P<slug>[^/.]+)/$',
|
||||||
views.DiaperChangesChildReport.as_view(), name='report-diaperchange'),
|
views.DiaperChangesChildReport.as_view(),
|
||||||
url(r'^reports/(?P<slug>[^/.]+)/sleep/$',
|
name='report-diaperchange-child'),
|
||||||
views.SleepReport.as_view(), name='report-sleep'),
|
url(r'^reports/sleep/(?P<slug>[^/.]+)$',
|
||||||
|
views.SleepChildReport.as_view(), name='report-sleep-child'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -76,12 +76,8 @@ class DiaperChangesChildReport(PermissionRequiredMixin, DetailView):
|
||||||
self.javascript += javascript
|
self.javascript += javascript
|
||||||
|
|
||||||
|
|
||||||
class SleepReport(PermissionRequiredMixin, DetailView):
|
class SleepChildReport(PermissionRequiredMixin, DetailView):
|
||||||
"""All sleep data for a child."""
|
"""All sleep data for a child."""
|
||||||
model = Child
|
model = Child
|
||||||
permission_required = ('core.view_child',)
|
permission_required = ('core.view_child',)
|
||||||
template_name = 'reports/sleep.html'
|
template_name = 'reports/sleep.html'
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
context = super(SleepReport, self).get_context_data(**kwargs)
|
|
||||||
return context
|
|
||||||
|
|
Loading…
Reference in New Issue