diff --git a/core/templates/core/base.html b/core/templates/core/base.html index 3d807083..93a707a6 100644 --- a/core/templates/core/base.html +++ b/core/templates/core/base.html @@ -27,16 +27,31 @@ -
+
{% block content %}{% endblock %}
diff --git a/core/templates/core/child_list.html b/core/templates/core/child_list.html index bbd3ae87..8a4b05d1 100644 --- a/core/templates/core/child_list.html +++ b/core/templates/core/child_list.html @@ -1,40 +1,42 @@ {% extends 'core/base.html' %} -{% load i18n widget_tweaks %} +{% load widget_tweaks %} {% block title %}Children{% endblock %} {% block content %}

Children

- - - - - - - - - - - - {% for child in object_list %} +
+
#First NameLast NameBirth DateActions
+ - - - - - + + + + + - {% empty %} - - - - {% endfor %} - -
{{ child.id }}{{ child.first_name }}{{ child.last_name }}{{ child.birth_date }} -
- - -
-
#First NameLast NameBirth DateActions
No children added.
+ + + {% for child in object_list %} + + {{ child.id }} + {{ child.first_name }} + {{ child.last_name }} + {{ child.birth_date }} + +
+ + +
+ + + {% empty %} + + No children found. + + {% endfor %} + + +
Add a Child {% endblock %} \ No newline at end of file diff --git a/core/templates/core/diaperchange_confirm_delete.html b/core/templates/core/diaperchange_confirm_delete.html new file mode 100644 index 00000000..752ede02 --- /dev/null +++ b/core/templates/core/diaperchange_confirm_delete.html @@ -0,0 +1,13 @@ +{% extends 'core/base.html' %} +{% load widget_tweaks %} + +{% block title %}Delete a Diaper Change{% endblock %} + +{% block content %} +
+ {% csrf_token %} +

Are you sure you want to delete {{ object }}?

+ + Cancel +
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/diaperchange_form.html b/core/templates/core/diaperchange_form.html new file mode 100644 index 00000000..476c85ff --- /dev/null +++ b/core/templates/core/diaperchange_form.html @@ -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 %} +

Update {{ object }}

+ {% else %} +

Add a Diaper Change

+ {% endif %} +
+ {% csrf_token %} + {% for field in form %} +
+ + {% if field.errors %} + {{ field|attr:"class:form-control is-invalid" }} + {% else %} + {{ field|attr:"class:form-control" }} + {% endif %} + {% if field.help_text %} +

{{ field.help_text }}

+ {% endif %} + {% if field.errors %} +

{% for error in field.errors %}{{ error }}{% endfor %}

+ {% endif %} +
+ {% endfor %} + + Cancel +
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/diaperchange_list.html b/core/templates/core/diaperchange_list.html new file mode 100644 index 00000000..af2af162 --- /dev/null +++ b/core/templates/core/diaperchange_list.html @@ -0,0 +1,46 @@ +{% extends 'core/base.html' %} +{% load widget_tweaks %} + +{% block title %}Diaper Changes{% endblock %} + +{% block content %} +

Diaper Changes

+
+ + + + + + + + + + + + + + {% for change in object_list %} + + + + + + + + + + {% empty %} + + + + {% endfor %} + +
#ChildTimeWetSolidColorActions
{{ change.id }}{{ change.child }}{{ change.time }}{{ change.wet }}{{ change.solid }}{{ change.color }} +
+ + +
+
No diaper changes found.
+
+ Add a Change +{% endblock %} \ No newline at end of file diff --git a/core/templates/core/feeding_confirm_delete.html b/core/templates/core/feeding_confirm_delete.html new file mode 100644 index 00000000..179a7ee4 --- /dev/null +++ b/core/templates/core/feeding_confirm_delete.html @@ -0,0 +1,13 @@ +{% extends 'core/base.html' %} +{% load widget_tweaks %} + +{% block title %}Delete a Feeding{% endblock %} + +{% block content %} +
+ {% csrf_token %} +

Are you sure you want to delete {{ object }}?

+ + Cancel +
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/feeding_form.html b/core/templates/core/feeding_form.html new file mode 100644 index 00000000..6a2b3820 --- /dev/null +++ b/core/templates/core/feeding_form.html @@ -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 %} +

Update {{ object }}

+ {% else %} +

Add a Feeding

+ {% endif %} +
+ {% csrf_token %} + {% for field in form %} +
+ + {% if field.errors %} + {{ field|attr:"class:form-control is-invalid" }} + {% else %} + {{ field|attr:"class:form-control" }} + {% endif %} + {% if field.help_text %} +

{{ field.help_text }}

+ {% endif %} + {% if field.errors %} +

{% for error in field.errors %}{{ error }}{% endfor %}

+ {% endif %} +
+ {% endfor %} + + Cancel +
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/feeding_list.html b/core/templates/core/feeding_list.html new file mode 100644 index 00000000..0eb3f0f2 --- /dev/null +++ b/core/templates/core/feeding_list.html @@ -0,0 +1,48 @@ +{% extends 'core/base.html' %} +{% load widget_tweaks %} + +{% block title %}Feedings{% endblock %} + +{% block content %} +

Feedings

+
+ + + + + + + + + + + + + + + {% for feeding in object_list %} + + + + + + + + + + + {% empty %} + + + + {% endfor %} + +
#ChildStartEndDurationTypeMethodActions
{{ feeding.id }}{{ feeding.child }}{{ feeding.start }}{{ feeding.end }}{{ feeding.duration }}{{ feeding.type }}{{ feeding.method }} +
+ + +
+
No feedings found.
+
+ Add a Feeding +{% endblock %} \ No newline at end of file diff --git a/core/templates/core/note_confirm_delete.html b/core/templates/core/note_confirm_delete.html new file mode 100644 index 00000000..f8d1f2fb --- /dev/null +++ b/core/templates/core/note_confirm_delete.html @@ -0,0 +1,13 @@ +{% extends 'core/base.html' %} +{% load widget_tweaks %} + +{% block title %}Delete a Note{% endblock %} + +{% block content %} +
+ {% csrf_token %} +

Are you sure you want to delete {{ object }}?

+ + Cancel +
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/note_form.html b/core/templates/core/note_form.html new file mode 100644 index 00000000..925c68c7 --- /dev/null +++ b/core/templates/core/note_form.html @@ -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 %} +

Update {{ object }}

+ {% else %} +

Add a Note

+ {% endif %} +
+ {% csrf_token %} + {% for field in form %} +
+ + {% if field.errors %} + {{ field|attr:"class:form-control is-invalid" }} + {% else %} + {{ field|attr:"class:form-control" }} + {% endif %} + {% if field.help_text %} +

{{ field.help_text }}

+ {% endif %} + {% if field.errors %} +

{% for error in field.errors %}{{ error }}{% endfor %}

+ {% endif %} +
+ {% endfor %} + + Cancel +
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/note_list.html b/core/templates/core/note_list.html new file mode 100644 index 00000000..aa0789ff --- /dev/null +++ b/core/templates/core/note_list.html @@ -0,0 +1,42 @@ +{% extends 'core/base.html' %} +{% load widget_tweaks %} + +{% block title %}Notes{% endblock %} + +{% block content %} +

Notes

+
+ + + + + + + + + + + + {% for note in object_list %} + + + + + + + + {% empty %} + + + + {% endfor %} + +
#ChildNoteTimeActions
{{ note.id }}{{ note.child }}{{ note.note }}{{ note.time }} +
+ + +
+
No notes found.
+
+ Add a Note +{% endblock %} \ No newline at end of file diff --git a/core/templates/core/sleep_confirm_delete.html b/core/templates/core/sleep_confirm_delete.html new file mode 100644 index 00000000..25241171 --- /dev/null +++ b/core/templates/core/sleep_confirm_delete.html @@ -0,0 +1,13 @@ +{% extends 'core/base.html' %} +{% load widget_tweaks %} + +{% block title %}Delete a Sleep Entry{% endblock %} + +{% block content %} +
+ {% csrf_token %} +

Are you sure you want to delete {{ object }}?

+ + Cancel +
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/sleep_form.html b/core/templates/core/sleep_form.html new file mode 100644 index 00000000..16195d5f --- /dev/null +++ b/core/templates/core/sleep_form.html @@ -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 %} +

Update {{ object }}

+ {% else %} +

Add a Sleep Entry

+ {% endif %} +
+ {% csrf_token %} + {% for field in form %} +
+ + {% if field.errors %} + {{ field|attr:"class:form-control is-invalid" }} + {% else %} + {{ field|attr:"class:form-control" }} + {% endif %} + {% if field.help_text %} +

{{ field.help_text }}

+ {% endif %} + {% if field.errors %} +

{% for error in field.errors %}{{ error }}{% endfor %}

+ {% endif %} +
+ {% endfor %} + + Cancel +
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/sleep_list.html b/core/templates/core/sleep_list.html new file mode 100644 index 00000000..fbf8345c --- /dev/null +++ b/core/templates/core/sleep_list.html @@ -0,0 +1,44 @@ +{% extends 'core/base.html' %} +{% load widget_tweaks %} + +{% block title %}Sleep{% endblock %} + +{% block content %} +

Sleep

+
+ + + + + + + + + + + + + {% for sleep in object_list %} + + + + + + + + + {% empty %} + + + + {% endfor %} + +
#ChildStartEndDurationActions
{{ sleep.id }}{{ sleep.child }}{{ sleep.start }}{{ sleep.end }}{{ sleep.duration }} +
+ + +
+
No sleep entries found.
+
+ Add a Sleep Entry +{% endblock %} \ No newline at end of file diff --git a/core/templates/core/tummytime_confirm_delete.html b/core/templates/core/tummytime_confirm_delete.html new file mode 100644 index 00000000..781c80c1 --- /dev/null +++ b/core/templates/core/tummytime_confirm_delete.html @@ -0,0 +1,13 @@ +{% extends 'core/base.html' %} +{% load widget_tweaks %} + +{% block title %}Delete a Tummy Time Entry{% endblock %} + +{% block content %} +
+ {% csrf_token %} +

Are you sure you want to delete {{ object }}?

+ + Cancel +
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/tummytime_form.html b/core/templates/core/tummytime_form.html new file mode 100644 index 00000000..ab95f057 --- /dev/null +++ b/core/templates/core/tummytime_form.html @@ -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 %} +

Update {{ object }}

+ {% else %} +

Add a Tummy Time Entry

+ {% endif %} +
+ {% csrf_token %} + {% for field in form %} +
+ + {% if field.errors %} + {{ field|attr:"class:form-control is-invalid" }} + {% else %} + {{ field|attr:"class:form-control" }} + {% endif %} + {% if field.help_text %} +

{{ field.help_text }}

+ {% endif %} + {% if field.errors %} +

{% for error in field.errors %}{{ error }}{% endfor %}

+ {% endif %} +
+ {% endfor %} + + Cancel +
+{% endblock %} \ No newline at end of file diff --git a/core/templates/core/tummytime_list.html b/core/templates/core/tummytime_list.html new file mode 100644 index 00000000..9028d8a8 --- /dev/null +++ b/core/templates/core/tummytime_list.html @@ -0,0 +1,46 @@ +{% extends 'core/base.html' %} +{% load widget_tweaks %} + +{% block title %}Tummy Time{% endblock %} + +{% block content %} +

Tummy Time

+
+ + + + + + + + + + + + + + {% for tummytime in object_list %} + + + + + + + + + + {% empty %} + + + + {% endfor %} + +
#ChildStartEndDurationMilestoneActions
{{ tummytime.id }}{{ tummytime.child }}{{ tummytime.start }}{{ tummytime.end }}{{ tummytime.duration }}{{ tummytime.milestone }} +
+ + +
+
No tummy time entries found.
+
+ Add a Tummy Time Entry +{% endblock %} \ No newline at end of file diff --git a/core/urls.py b/core/urls.py index 17a99ec2..d8c56c10 100644 --- a/core/urls.py +++ b/core/urls.py @@ -14,4 +14,42 @@ urlpatterns = [ name='child-update'), url(r'children/(?P[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[0-9]+)/$', views.DiaperChangeUpdate.as_view(), + name='diaperchange-update'), + url(r'changes/(?P[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[0-9]+)/$', views.FeedingUpdate.as_view(), + name='feeding-update'), + url(r'feedings/(?P[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[0-9]+)/$', views.NoteUpdate.as_view(), + name='note-update'), + url(r'notes/(?P[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[0-9]+)/$', views.SleepUpdate.as_view(), + name='sleep-update'), + url(r'sleep/(?P[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[0-9]+)/$', views.TummyTimeUpdate.as_view(), + name='tummytime-update'), + url(r'tummy-time/(?P[0-9]+)/delete/$', views.TummyTimeDelete.as_view(), + name='tummytime-delete'), ] diff --git a/core/views.py b/core/views.py index b556f03c..b4d0991c 100644 --- a/core/views.py +++ b/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'