diff --git a/core/models.py b/core/models.py
index b6e58b8a..2b831836 100644
--- a/core/models.py
+++ b/core/models.py
@@ -26,6 +26,12 @@ class Child(models.Model):
self.slug = slugify(self)
super(Child, self).save(*args, **kwargs)
+ def name(self, reverse=False):
+ if reverse:
+ return '{}, {}'.format(self.last_name, self.first_name)
+ else:
+ return '{} {}'.format(self.first_name, self.last_name)
+
class DiaperChange(models.Model):
child = models.ForeignKey('Child', related_name='diaper_change')
diff --git a/core/templates/core/child_list.html b/core/templates/core/child_list.html
index 779e24cb..aef33e32 100644
--- a/core/templates/core/child_list.html
+++ b/core/templates/core/child_list.html
@@ -24,7 +24,7 @@
- {% if perms.core.change_child %}
+ {% if perms.core.view_child %}
diff --git a/dashboard/templates/dashboard/dashboard.html b/dashboard/templates/dashboard/dashboard.html
index d76038a4..be272618 100644
--- a/dashboard/templates/dashboard/dashboard.html
+++ b/dashboard/templates/dashboard/dashboard.html
@@ -3,28 +3,27 @@
{% block title %}Welcome!{% endblock %}
{% block content %}
-
-
-
- awake time
+
+ {% for child in objects %}
+
+ ![](data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22259%22%20height%3D%22180%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20259%20180%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_15e152b1929%20text%20%7B%20fill%3Argba(255%2C255%2C255%2C.75)%3Bfont-weight%3Anormal%3Bfont-family%3AHelvetica%2C%20monospace%3Bfont-size%3A13pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_15e152b1929%22%3E%3Crect%20width%3D%22259%22%20height%3D%22180%22%20fill%3D%22%23777%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%2296.26666641235352%22%20y%3D%2296%22%3E259x180%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E)
+
+
+ {{ child.name }}
+ {{ child.birth_date }}
+
+
+ {% if perms.core.view_child %}
+
+
+
+ {% endif %}
+
-
- last feeding
-
-
- change statistics
-
-
-
-
- tummy time for the day
-
-
- available
-
-
- available
+
+ {% endfor %}
{% endblock %}
\ No newline at end of file
diff --git a/dashboard/urls.py b/dashboard/urls.py
index cd10532e..08170143 100644
--- a/dashboard/urls.py
+++ b/dashboard/urls.py
@@ -6,8 +6,8 @@ from django.conf.urls import url
from . import views
urlpatterns = [
- url(r'^$', views.DashboardRedirect.as_view(), name='dashboard'),
- url(r'^dashboard/$', views.Dashboard.as_view(), name='dashboard-all'),
+ url(r'^$', views.DashboardRedirect.as_view(), name='dashboard-redirect'),
+ url(r'^dashboard/$', views.Dashboard.as_view(), name='dashboard'),
url(r'^children/(?P [^/.]+)/dashboard/$',
views.ChildDashboard.as_view(), name='dashboard-child'),
]
diff --git a/dashboard/views.py b/dashboard/views.py
index 5c5d5bf2..213029d2 100644
--- a/dashboard/views.py
+++ b/dashboard/views.py
@@ -28,6 +28,11 @@ class DashboardRedirect(LoginRequiredMixin, RedirectView):
class Dashboard(LoginRequiredMixin, TemplateView):
template_name = 'dashboard/dashboard.html'
+ def get_context_data(self, **kwargs):
+ context = super(Dashboard, self).get_context_data(**kwargs)
+ context['objects'] = Child.objects.all().order_by('last_name')
+ return context
+
class ChildDashboard(PermissionRequiredMixin, DetailView):
model = Child
|