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 %}
+
+
+
+
+ {{ 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
|