Add dashboard link to child list.

This commit is contained in:
Christopher Charbonneau Wells 2017-08-19 14:57:21 -04:00
parent 502964e070
commit f30ef88d1b
3 changed files with 8 additions and 2 deletions

View File

@ -26,6 +26,12 @@
<td class="text-center">
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
{% if perms.core.change_child %}
<a href="{% url 'dashboard-child' child.slug %}" class="btn btn-success">
<i class="fa fa-tachometer" aria-hidden="true"></i>
</a>
{% endif %}
{% if perms.core.change_child %}
<a href="{% url 'child-update' child.slug %}" class="btn btn-primary">
<i class="fa fa-pencil" aria-hidden="true"></i>

View File

@ -9,5 +9,5 @@ urlpatterns = [
url(r'^$', views.DashboardRedirect.as_view(), name='dashboard'),
url(r'^dashboard/$', views.Dashboard.as_view(), name='dashboard'),
url(r'children/(?P<slug>[^/.]+)/dashboard/$',
views.ChildDashboard.as_view(), name='child-dashboard'),
views.ChildDashboard.as_view(), name='dashboard-child'),
]

View File

@ -15,7 +15,7 @@ class DashboardRedirect(LoginRequiredMixin, RedirectView):
def get(self, request, *args, **kwargs):
if Child.objects.count() == 1:
child_instance = Child.objects.first()
self.url = reverse('child-dashboard', args={child_instance.slug})
self.url = reverse('dashboard-child', args={child_instance.slug})
else:
self.url = reverse('dashboard')
return super(DashboardRedirect, self).get(request, *args, **kwargs)