Add slug-based child URLs.

Also some beginnings of the dashboard system (WIP).
This commit is contained in:
Christopher Charbonneau Wells 2017-08-18 08:17:45 -04:00
parent 37f28c3ff7
commit 5d4beea512
6 changed files with 39 additions and 10 deletions

View File

@ -14,7 +14,7 @@
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item{% if request.path == '/' %} active{% endif %}">
<a class="nav-link" href="{% url 'index' %}">
<a class="nav-link" href="{% url 'dashboard' %}">
<i class="fa fa-dashboard" aria-hidden="true"></i> Dashboard
</a>
</li>

View File

@ -27,13 +27,13 @@
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
{% if perms.core.change_child %}
<a href="{% url 'child-update' child.id %}" class="btn btn-primary">
<a href="{% url 'child-update' child.slug %}" class="btn btn-primary">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
{% endif %}
{% if perms.core.delete_child %}
<a href="{% url 'child-delete' child.id %}" class="btn btn-danger">
<a href="{% url 'child-delete' child.slug %}" class="btn btn-danger">
<i class="fa fa-trash-o" aria-hidden="true"></i>
</a>
{% endif %}

View File

@ -0,0 +1,30 @@
{% extends 'babyblotter/page.html' %}
{% block title %}Welcome!{% endblock %}
{% block content %}
<div class="container">
<div class="row align-items-start text-center">
<div class="col-sm-12 col-md-4 border">
awake time
</div>
<div class="col-sm-12 col-md-4 border">
last feeding
</div>
<div class="col-sm-12 col-md-4 border">
change statistics
</div>
</div>
<div class="row align-items-start text-center">
<div class="col-sm-12 col-md-4 border">
tummy time for the day
</div>
<div class="col-sm-12 col-md-4 border">
available
</div>
<div class="col-sm-12 col-md-4 border">
available
</div>
</div>
</div>
{% endblock %}

View File

@ -1,5 +0,0 @@
{% extends 'babyblotter/page.html' %}
{% block title %}Welcome!{% endblock %}
{% block content %}<h1>Hello!</h1>{% endblock %}

View File

@ -6,14 +6,18 @@ from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.Dashboard.as_view(), name='index'),
url(r'^$', views.Dashboard.as_view(), name='dashboard'),
url(r'children/$', views.ChildList.as_view(), name='child-list'),
url(r'children/add/$', views.ChildAdd.as_view(), name='child-add'),
url(r'children/(?P<pk>[0-9]+)/$', views.ChildUpdate.as_view(),
name='child-update'),
url(r'children/(?P<slug>[^/.]+)/$', views.ChildUpdate.as_view(),
name='child-update'),
url(r'children/(?P<pk>[0-9]+)/delete/$', views.ChildDelete.as_view(),
name='child-delete'),
url(r'children/(?P<slug>[^/.]+)/delete/$', views.ChildDelete.as_view(),
name='child-delete'),
url(r'changes/$', views.DiaperChangeList.as_view(),
name='diaperchange-list'),

View File

@ -16,7 +16,7 @@ from .forms import (ChildForm, DiaperChangeForm, FeedingForm, SleepForm,
class Dashboard(LoginRequiredMixin, TemplateView):
template_name = 'core/index.html'
template_name = 'core/dashboard.html'
class ChildList(PermissionRequiredMixin, ListView):