Create skeleton of reports app.

This commit is contained in:
Christopher Charbonneau Wells 2017-08-21 19:21:08 -04:00
parent 7bffb41718
commit 8ae33b0f48
8 changed files with 35 additions and 0 deletions

View File

View File

@ -18,6 +18,7 @@ INSTALLED_APPS = [
'babyblotter',
'core',
'dashboard',
'reports',
'rest_framework',
'widget_tweaks',

0
reports/__init__.py Normal file
View File

View File

View File

@ -0,0 +1,7 @@
{% extends 'babyblotter/page.html' %}
{% block title %}Sleep Report - {{ object }}{% endblock %}
{% block content %}
Sleep report for {{ object }}.
{% endblock %}

3
reports/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

11
reports/urls.py Normal file
View File

@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^reports/(?P<slug>[^/.]+)/sleep/$',
views.SleepReport.as_view(), name='report-sleep'),
]

13
reports/views.py Normal file
View File

@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.views.generic.detail import DetailView
from core.models import Child
class SleepReport(PermissionRequiredMixin, DetailView):
model = Child
permission_required = ('core.view_child',)
template_name = 'reports/sleep.html'