mirror of https://github.com/snachodog/mybuddy.git
Add slug-based child URLs.
Also some beginnings of the dashboard system (WIP).
This commit is contained in:
parent
37f28c3ff7
commit
5d4beea512
|
@ -14,7 +14,7 @@
|
||||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
<li class="nav-item{% if request.path == '/' %} active{% endif %}">
|
<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
|
<i class="fa fa-dashboard" aria-hidden="true"></i> Dashboard
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||||
|
|
||||||
{% if perms.core.change_child %}
|
{% 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>
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if perms.core.delete_child %}
|
{% 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>
|
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -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 %}
|
|
@ -1,5 +0,0 @@
|
||||||
{% extends 'babyblotter/page.html' %}
|
|
||||||
|
|
||||||
{% block title %}Welcome!{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}<h1>Hello!</h1>{% endblock %}
|
|
|
@ -6,14 +6,18 @@ from django.conf.urls import url
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
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/$', views.ChildList.as_view(), name='child-list'),
|
||||||
url(r'children/add/$', views.ChildAdd.as_view(), name='child-add'),
|
url(r'children/add/$', views.ChildAdd.as_view(), name='child-add'),
|
||||||
url(r'children/(?P<pk>[0-9]+)/$', views.ChildUpdate.as_view(),
|
url(r'children/(?P<pk>[0-9]+)/$', views.ChildUpdate.as_view(),
|
||||||
name='child-update'),
|
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(),
|
url(r'children/(?P<pk>[0-9]+)/delete/$', views.ChildDelete.as_view(),
|
||||||
name='child-delete'),
|
name='child-delete'),
|
||||||
|
url(r'children/(?P<slug>[^/.]+)/delete/$', views.ChildDelete.as_view(),
|
||||||
|
name='child-delete'),
|
||||||
|
|
||||||
url(r'changes/$', views.DiaperChangeList.as_view(),
|
url(r'changes/$', views.DiaperChangeList.as_view(),
|
||||||
name='diaperchange-list'),
|
name='diaperchange-list'),
|
||||||
|
|
|
@ -16,7 +16,7 @@ from .forms import (ChildForm, DiaperChangeForm, FeedingForm, SleepForm,
|
||||||
|
|
||||||
|
|
||||||
class Dashboard(LoginRequiredMixin, TemplateView):
|
class Dashboard(LoginRequiredMixin, TemplateView):
|
||||||
template_name = 'core/index.html'
|
template_name = 'core/dashboard.html'
|
||||||
|
|
||||||
|
|
||||||
class ChildList(PermissionRequiredMixin, ListView):
|
class ChildList(PermissionRequiredMixin, ListView):
|
||||||
|
|
Loading…
Reference in New Issue