mirror of https://github.com/snachodog/mybuddy.git
Add basic forms for remaining models.
This commit is contained in:
parent
6a88ff0ea7
commit
9841eaa563
|
@ -27,16 +27,31 @@
|
|||
<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' %}">Home</a>
|
||||
<a class="nav-link" href="{% url 'index' %}"><i class="fa fa-home" aria-hidden="true"></i> Home</a>
|
||||
</li>
|
||||
<li class="nav-item{% if request.path == '/children/' %} active{% endif %}">
|
||||
<a class="nav-link" href="{% url 'child-list' %}">Children</a>
|
||||
<a class="nav-link" href="{% url 'child-list' %}"><i class="fa fa-child" aria-hidden="true"></i> Children</a>
|
||||
</li>
|
||||
<li class="nav-item{% if request.path == '/changes/' %} active{% endif %}">
|
||||
<a class="nav-link" href="{% url 'diaperchange-list' %}"><i class="fa fa-trash" aria-hidden="true"></i> Changes</a>
|
||||
</li>
|
||||
<li class="nav-item{% if request.path == '/feedings/' %} active{% endif %}">
|
||||
<a class="nav-link" href="{% url 'feeding-list' %}"><i class="fa fa-spoon" aria-hidden="true"></i> Feedings</a>
|
||||
</li>
|
||||
<li class="nav-item{% if request.path == '/sleep/' %} active{% endif %}">
|
||||
<a class="nav-link" href="{% url 'sleep-list' %}"><i class="fa fa-bed" aria-hidden="true"></i> Sleep</a>
|
||||
</li>
|
||||
<li class="nav-item{% if request.path == '/tummy-time/' %} active{% endif %}">
|
||||
<a class="nav-link" href="{% url 'tummytime-list' %}"><i class="fa fa-smile-o" aria-hidden="true"></i> Tummy Time</a>
|
||||
</li>
|
||||
<li class="nav-item{% if request.path == '/notes/' %} active{% endif %}">
|
||||
<a class="nav-link" href="{% url 'note-list' %}"><i class="fa fa-sticky-note" aria-hidden="true"></i> Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container" style="padding: 3rem 1.5rem;">
|
||||
<div class="container-fluid">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load i18n widget_tweaks %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Children{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Children</h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
<tr>
|
||||
|
@ -23,7 +24,7 @@
|
|||
<td>{{ child.last_name }}</td>
|
||||
<td>{{ child.birth_date }}</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="Child actions">
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||
<a href="{% url 'child-update' child.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
||||
<a href="{% url 'child-delete' child.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
||||
</div>
|
||||
|
@ -31,10 +32,11 @@
|
|||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<th colspan="4">No children added.</th>
|
||||
<th colspan="4">No children found.</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<a href="{% url 'child-add' %}" class="btn btn-sm btn-success"><i class="fa fa-child" aria-hidden="true"></i> Add a Child</a>
|
||||
{% endblock %}
|
|
@ -0,0 +1,13 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Delete a Diaper Change{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form role="form" method="post">
|
||||
{% csrf_token %}
|
||||
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>
|
||||
<input type="submit" value="Delete" class="btn btn-danger" />
|
||||
<a href="{% url 'diaperchange-list' %}" class="btn btn-default">Cancel</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,39 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}
|
||||
{% if request.resolver_match.url_name == 'diaperchange-update' %}
|
||||
Update a Diaper Change
|
||||
{% else %}
|
||||
Add a Diaper Change
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if object %}
|
||||
<h1>Update <span class="text-info">{{ object }}</span></h1>
|
||||
{% else %}
|
||||
<h1>Add a Diaper Change</h1>
|
||||
{% endif %}
|
||||
<form role="form" method="post">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<div class="form-group">
|
||||
<label for="id_{{ field.name }}">{{ field.label }}</label>
|
||||
{% if field.errors %}
|
||||
{{ field|attr:"class:form-control is-invalid" }}
|
||||
{% else %}
|
||||
{{ field|attr:"class:form-control" }}
|
||||
{% endif %}
|
||||
{% if field.help_text %}
|
||||
<p class="help-block"><small>{{ field.help_text }}</small></p>
|
||||
{% endif %}
|
||||
{% if field.errors %}
|
||||
<p class="invalid-feedback">{% for error in field.errors %}{{ error }}{% endfor %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<a href="{% url 'diaperchange-list' %}" class="btn btn-default">Cancel</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,46 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Diaper Changes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Diaper Changes</h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Child</th>
|
||||
<th>Time</th>
|
||||
<th>Wet</th>
|
||||
<th>Solid</th>
|
||||
<th>Color</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for change in object_list %}
|
||||
<tr>
|
||||
<th scope="row">{{ change.id }}</th>
|
||||
<td>{{ change.child }}</td>
|
||||
<td>{{ change.time }}</td>
|
||||
<td>{{ change.wet }}</td>
|
||||
<td>{{ change.solid }}</td>
|
||||
<td>{{ change.color }}</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||
<a href="{% url 'diaperchange-update' change.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
||||
<a href="{% url 'diaperchange-delete' change.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<th colspan="7">No diaper changes found.</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<a href="{% url 'diaperchange-add' %}" class="btn btn-sm btn-success"><i class="fa fa-trash" aria-hidden="true"></i> Add a Change</a>
|
||||
{% endblock %}
|
|
@ -0,0 +1,13 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Delete a Feeding{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form role="form" method="post">
|
||||
{% csrf_token %}
|
||||
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>
|
||||
<input type="submit" value="Delete" class="btn btn-danger" />
|
||||
<a href="{% url 'feeding-list' %}" class="btn btn-default">Cancel</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,39 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}
|
||||
{% if request.resolver_match.url_name == 'feeding-update' %}
|
||||
Update a Feeding
|
||||
{% else %}
|
||||
Add a Feeding
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if object %}
|
||||
<h1>Update <span class="text-info">{{ object }}</span></h1>
|
||||
{% else %}
|
||||
<h1>Add a Feeding</h1>
|
||||
{% endif %}
|
||||
<form role="form" method="post">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<div class="form-group">
|
||||
<label for="id_{{ field.name }}">{{ field.label }}</label>
|
||||
{% if field.errors %}
|
||||
{{ field|attr:"class:form-control is-invalid" }}
|
||||
{% else %}
|
||||
{{ field|attr:"class:form-control" }}
|
||||
{% endif %}
|
||||
{% if field.help_text %}
|
||||
<p class="help-block"><small>{{ field.help_text }}</small></p>
|
||||
{% endif %}
|
||||
{% if field.errors %}
|
||||
<p class="invalid-feedback">{% for error in field.errors %}{{ error }}{% endfor %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<a href="{% url 'feeding-list' %}" class="btn btn-default">Cancel</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,48 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Feedings{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Feedings</h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Child</th>
|
||||
<th>Start</th>
|
||||
<th>End</th>
|
||||
<th>Duration</th>
|
||||
<th>Type</th>
|
||||
<th>Method</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for feeding in object_list %}
|
||||
<tr>
|
||||
<th scope="row">{{ feeding.id }}</th>
|
||||
<td>{{ feeding.child }}</td>
|
||||
<td>{{ feeding.start }}</td>
|
||||
<td>{{ feeding.end }}</td>
|
||||
<td>{{ feeding.duration }}</td>
|
||||
<td>{{ feeding.type }}</td>
|
||||
<td>{{ feeding.method }}</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||
<a href="{% url 'feeding-update' feeding.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
||||
<a href="{% url 'feeding-delete' feeding.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<th colspan="8">No feedings found.</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<a href="{% url 'feeding-add' %}" class="btn btn-sm btn-success"><i class="fa fa-spoon" aria-hidden="true"></i> Add a Feeding</a>
|
||||
{% endblock %}
|
|
@ -0,0 +1,13 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Delete a Note{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form role="form" method="post">
|
||||
{% csrf_token %}
|
||||
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>
|
||||
<input type="submit" value="Delete" class="btn btn-danger" />
|
||||
<a href="{% url 'note-list' %}" class="btn btn-default">Cancel</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,39 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}
|
||||
{% if request.resolver_match.url_name == 'note-update' %}
|
||||
Update a Note
|
||||
{% else %}
|
||||
Add a Note
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if object %}
|
||||
<h1>Update <span class="text-info">{{ object }}</span></h1>
|
||||
{% else %}
|
||||
<h1>Add a Note</h1>
|
||||
{% endif %}
|
||||
<form role="form" method="post">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<div class="form-group">
|
||||
<label for="id_{{ field.name }}">{{ field.label }}</label>
|
||||
{% if field.errors %}
|
||||
{{ field|attr:"class:form-control is-invalid" }}
|
||||
{% else %}
|
||||
{{ field|attr:"class:form-control" }}
|
||||
{% endif %}
|
||||
{% if field.help_text %}
|
||||
<p class="help-block"><small>{{ field.help_text }}</small></p>
|
||||
{% endif %}
|
||||
{% if field.errors %}
|
||||
<p class="invalid-feedback">{% for error in field.errors %}{{ error }}{% endfor %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<a href="{% url 'note-list' %}" class="btn btn-default">Cancel</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,42 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Notes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Notes</h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Child</th>
|
||||
<th>Note</th>
|
||||
<th>Time</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for note in object_list %}
|
||||
<tr>
|
||||
<th scope="row">{{ note.id }}</th>
|
||||
<td>{{ note.child }}</td>
|
||||
<td>{{ note.note }}</td>
|
||||
<td>{{ note.time }}</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||
<a href="{% url 'note-update' note.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
||||
<a href="{% url 'note-delete' note.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<th colspan="5">No notes found.</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<a href="{% url 'note-add' %}" class="btn btn-sm btn-success"><i class="fa fa-sticky-note" aria-hidden="true"></i> Add a Note</a>
|
||||
{% endblock %}
|
|
@ -0,0 +1,13 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Delete a Sleep Entry{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form role="form" method="post">
|
||||
{% csrf_token %}
|
||||
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>
|
||||
<input type="submit" value="Delete" class="btn btn-danger" />
|
||||
<a href="{% url 'sleep-list' %}" class="btn btn-default">Cancel</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,39 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}
|
||||
{% if request.resolver_match.url_name == 'sleep-update' %}
|
||||
Update a Sleep Entry
|
||||
{% else %}
|
||||
Add a Sleep Entry
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if object %}
|
||||
<h1>Update <span class="text-info">{{ object }}</span></h1>
|
||||
{% else %}
|
||||
<h1>Add a Sleep Entry</h1>
|
||||
{% endif %}
|
||||
<form role="form" method="post">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<div class="form-group">
|
||||
<label for="id_{{ field.name }}">{{ field.label }}</label>
|
||||
{% if field.errors %}
|
||||
{{ field|attr:"class:form-control is-invalid" }}
|
||||
{% else %}
|
||||
{{ field|attr:"class:form-control" }}
|
||||
{% endif %}
|
||||
{% if field.help_text %}
|
||||
<p class="help-block"><small>{{ field.help_text }}</small></p>
|
||||
{% endif %}
|
||||
{% if field.errors %}
|
||||
<p class="invalid-feedback">{% for error in field.errors %}{{ error }}{% endfor %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<a href="{% url 'sleep-list' %}" class="btn btn-default">Cancel</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,44 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Sleep{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Sleep</h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Child</th>
|
||||
<th>Start</th>
|
||||
<th>End</th>
|
||||
<th>Duration</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for sleep in object_list %}
|
||||
<tr>
|
||||
<th scope="row">{{ sleep.id }}</th>
|
||||
<td>{{ sleep.child }}</td>
|
||||
<td>{{ sleep.start }}</td>
|
||||
<td>{{ sleep.end }}</td>
|
||||
<td>{{ sleep.duration }}</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||
<a href="{% url 'sleep-update' sleep.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
||||
<a href="{% url 'sleep-delete' sleep.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<th colspan="6">No sleep entries found.</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<a href="{% url 'sleep-add' %}" class="btn btn-sm btn-success"><i class="fa fa-bed" aria-hidden="true"></i> Add a Sleep Entry</a>
|
||||
{% endblock %}
|
|
@ -0,0 +1,13 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Delete a Tummy Time Entry{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form role="form" method="post">
|
||||
{% csrf_token %}
|
||||
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>
|
||||
<input type="submit" value="Delete" class="btn btn-danger" />
|
||||
<a href="{% url 'tummytime-list' %}" class="btn btn-default">Cancel</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,39 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}
|
||||
{% if request.resolver_match.url_name == 'tummytime-update' %}
|
||||
Update a Tummy Time Entry
|
||||
{% else %}
|
||||
Add a Tummy Time Entry
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if object %}
|
||||
<h1>Update <span class="text-info">{{ object }}</span></h1>
|
||||
{% else %}
|
||||
<h1>Add a Tummy Time Entry</h1>
|
||||
{% endif %}
|
||||
<form role="form" method="post">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<div class="form-group">
|
||||
<label for="id_{{ field.name }}">{{ field.label }}</label>
|
||||
{% if field.errors %}
|
||||
{{ field|attr:"class:form-control is-invalid" }}
|
||||
{% else %}
|
||||
{{ field|attr:"class:form-control" }}
|
||||
{% endif %}
|
||||
{% if field.help_text %}
|
||||
<p class="help-block"><small>{{ field.help_text }}</small></p>
|
||||
{% endif %}
|
||||
{% if field.errors %}
|
||||
<p class="invalid-feedback">{% for error in field.errors %}{{ error }}{% endfor %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<a href="{% url 'tummytime-list' %}" class="btn btn-default">Cancel</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,46 @@
|
|||
{% extends 'core/base.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}Tummy Time{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Tummy Time</h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-inverse">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Child</th>
|
||||
<th>Start</th>
|
||||
<th>End</th>
|
||||
<th>Duration</th>
|
||||
<th>Milestone</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for tummytime in object_list %}
|
||||
<tr>
|
||||
<th scope="row">{{ tummytime.id }}</th>
|
||||
<td>{{ tummytime.child }}</td>
|
||||
<td>{{ tummytime.start }}</td>
|
||||
<td>{{ tummytime.end }}</td>
|
||||
<td>{{ tummytime.duration }}</td>
|
||||
<td>{{ tummytime.milestone }}</td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="Actions">
|
||||
<a href="{% url 'tummytime-update' tummytime.id %}" class="btn btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
||||
<a href="{% url 'tummytime-delete' tummytime.id %}" class="btn btn-danger"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<th colspan="7">No tummy time entries found.</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<a href="{% url 'tummytime-add' %}" class="btn btn-sm btn-success"><i class="fa fa-smile-o" aria-hidden="true"></i> Add a Tummy Time Entry</a>
|
||||
{% endblock %}
|
38
core/urls.py
38
core/urls.py
|
@ -14,4 +14,42 @@ urlpatterns = [
|
|||
name='child-update'),
|
||||
url(r'children/(?P<pk>[0-9]+)/delete/$', views.ChildDelete.as_view(),
|
||||
name='child-delete'),
|
||||
|
||||
url(r'changes/$', views.DiaperChangeList.as_view(),
|
||||
name='diaperchange-list'),
|
||||
url(r'changes/add/$', views.DiaperChangeAdd.as_view(),
|
||||
name='diaperchange-add'),
|
||||
url(r'changes/(?P<pk>[0-9]+)/$', views.DiaperChangeUpdate.as_view(),
|
||||
name='diaperchange-update'),
|
||||
url(r'changes/(?P<pk>[0-9]+)/delete/$', views.DiaperChangeDelete.as_view(),
|
||||
name='diaperchange-delete'),
|
||||
|
||||
url(r'feedings/$', views.FeedingList.as_view(), name='feeding-list'),
|
||||
url(r'feedings/add/$', views.FeedingAdd.as_view(), name='feeding-add'),
|
||||
url(r'feedings/(?P<pk>[0-9]+)/$', views.FeedingUpdate.as_view(),
|
||||
name='feeding-update'),
|
||||
url(r'feedings/(?P<pk>[0-9]+)/delete/$', views.FeedingDelete.as_view(),
|
||||
name='feeding-delete'),
|
||||
|
||||
url(r'notes/$', views.NoteList.as_view(), name='note-list'),
|
||||
url(r'notes/add/$', views.NoteAdd.as_view(), name='note-add'),
|
||||
url(r'notes/(?P<pk>[0-9]+)/$', views.NoteUpdate.as_view(),
|
||||
name='note-update'),
|
||||
url(r'notes/(?P<pk>[0-9]+)/delete/$', views.NoteDelete.as_view(),
|
||||
name='note-delete'),
|
||||
|
||||
url(r'sleep/$', views.SleepList.as_view(), name='sleep-list'),
|
||||
url(r'sleep/add/$', views.SleepAdd.as_view(), name='sleep-add'),
|
||||
url(r'sleep/(?P<pk>[0-9]+)/$', views.SleepUpdate.as_view(),
|
||||
name='sleep-update'),
|
||||
url(r'sleep/(?P<pk>[0-9]+)/delete/$', views.SleepDelete.as_view(),
|
||||
name='sleep-delete'),
|
||||
|
||||
url(r'tummy-time/$', views.TummyTimeList.as_view(), name='tummytime-list'),
|
||||
url(r'tummy-time/add/$', views.TummyTimeAdd.as_view(),
|
||||
name='tummytime-add'),
|
||||
url(r'tummy-time/(?P<pk>[0-9]+)/$', views.TummyTimeUpdate.as_view(),
|
||||
name='tummytime-update'),
|
||||
url(r'tummy-time/(?P<pk>[0-9]+)/delete/$', views.TummyTimeDelete.as_view(),
|
||||
name='tummytime-delete'),
|
||||
]
|
||||
|
|
107
core/views.py
107
core/views.py
|
@ -5,7 +5,7 @@ from django.views.generic.base import TemplateView
|
|||
from django.views.generic.edit import CreateView, UpdateView, DeleteView
|
||||
from django.views.generic.list import ListView
|
||||
|
||||
from .models import Child
|
||||
from .models import Child, DiaperChange, Feeding, Note, Sleep, TummyTime
|
||||
|
||||
|
||||
class Index(TemplateView):
|
||||
|
@ -31,3 +31,108 @@ class ChildUpdate(UpdateView):
|
|||
class ChildDelete(DeleteView):
|
||||
model = Child
|
||||
success_url = '/children'
|
||||
|
||||
|
||||
class DiaperChangeList(ListView):
|
||||
model = DiaperChange
|
||||
|
||||
|
||||
class DiaperChangeAdd(CreateView):
|
||||
model = DiaperChange
|
||||
fields = ['child', 'time', 'wet', 'solid', 'color']
|
||||
success_url = '/changes'
|
||||
|
||||
|
||||
class DiaperChangeUpdate(UpdateView):
|
||||
model = DiaperChange
|
||||
fields = ['child', 'time', 'wet', 'solid', 'color']
|
||||
success_url = '/changes'
|
||||
|
||||
|
||||
class DiaperChangeDelete(DeleteView):
|
||||
model = DiaperChange
|
||||
success_url = '/changes'
|
||||
|
||||
|
||||
class FeedingList(ListView):
|
||||
model = Feeding
|
||||
|
||||
|
||||
class FeedingAdd(CreateView):
|
||||
model = Feeding
|
||||
fields = ['child', 'start', 'end', 'type', 'method']
|
||||
success_url = '/feedings'
|
||||
|
||||
|
||||
class FeedingUpdate(UpdateView):
|
||||
model = Feeding
|
||||
fields = ['child', 'start', 'end', 'type', 'method']
|
||||
success_url = '/feedings'
|
||||
|
||||
|
||||
class FeedingDelete(DeleteView):
|
||||
model = Feeding
|
||||
success_url = '/feedings'
|
||||
|
||||
|
||||
class NoteList(ListView):
|
||||
model = Note
|
||||
|
||||
|
||||
class NoteAdd(CreateView):
|
||||
model = Note
|
||||
fields = ['child', 'note']
|
||||
success_url = '/notes'
|
||||
|
||||
|
||||
class NoteUpdate(UpdateView):
|
||||
model = Note
|
||||
fields = ['child', 'note']
|
||||
success_url = '/notes'
|
||||
|
||||
|
||||
class NoteDelete(DeleteView):
|
||||
model = Note
|
||||
success_url = '/notes'
|
||||
|
||||
|
||||
class SleepList(ListView):
|
||||
model = Sleep
|
||||
|
||||
|
||||
class SleepAdd(CreateView):
|
||||
model = Sleep
|
||||
fields = ['child', 'start', 'end']
|
||||
success_url = '/sleep'
|
||||
|
||||
|
||||
class SleepUpdate(UpdateView):
|
||||
model = Sleep
|
||||
fields = ['child', 'start', 'end']
|
||||
success_url = '/sleep'
|
||||
|
||||
|
||||
class SleepDelete(DeleteView):
|
||||
model = Sleep
|
||||
success_url = '/sleep'
|
||||
|
||||
|
||||
class TummyTimeList(ListView):
|
||||
model = TummyTime
|
||||
|
||||
|
||||
class TummyTimeAdd(CreateView):
|
||||
model = TummyTime
|
||||
fields = ['child', 'start', 'end', 'milestone']
|
||||
success_url = '/tummy-time'
|
||||
|
||||
|
||||
class TummyTimeUpdate(UpdateView):
|
||||
model = TummyTime
|
||||
fields = ['child', 'start', 'end', 'milestone']
|
||||
success_url = '/tummy-time'
|
||||
|
||||
|
||||
class TummyTimeDelete(DeleteView):
|
||||
model = TummyTime
|
||||
success_url = '/tummy-time'
|
||||
|
|
Loading…
Reference in New Issue