mirror of https://github.com/snachodog/mybuddy.git
Add Timer detail template (WIP).
This commit is contained in:
parent
b4eefea7f9
commit
24d797db01
|
@ -0,0 +1,19 @@
|
|||
{% extends 'babyblotter/page.html' %}
|
||||
|
||||
{% block title %}{{ object }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="jumbotron text-center">
|
||||
<h1 class="display-1">{{ object.duration }}</h1>
|
||||
<p class="lead text-muted">Started {{ object.start }} by {{ object.user }}</p>
|
||||
<a class="btn btn-success btn-lg btn-block p-3 mb-3" href="{% url 'feeding-add' %}" role="button">
|
||||
<i class="fa fa-spoon" aria-hidden="true"></i> Feeding</a>
|
||||
<a class="btn btn-success btn-lg btn-block p-3 mb-3" href="{% url 'sleep-add' %}" role="button">
|
||||
<i class="fa fa-bed" aria-hidden="true"></i> Sleep</a>
|
||||
<a class="btn btn-success btn-lg btn-block p-3 mb-3" href="{% url 'tummytime-add' %}" role="button">
|
||||
<i class="fa fa-smile-o" aria-hidden="true"></i> Tummy Time</a>
|
||||
<a class="btn btn-danger btn-lg btn-block p-3 mb-3" href="#" role="button">
|
||||
<i class="fa fa-times-circle" aria-hidden="true"></i> Delete Timer</a>
|
||||
</p>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -14,7 +14,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
{% for timer in timers %}
|
||||
<button class="dropdown-item" type="button">{{ timer }}</button>
|
||||
<a class="dropdown-item" href="{% url 'timer-detail' timer.id %}">{{ timer }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</li>
|
|
@ -48,6 +48,8 @@ urlpatterns = [
|
|||
url(r'timer/add/$', views.TimerAdd.as_view(), name='timer-add'),
|
||||
url(r'timer/add/quick/$', views.TimerAddQuick.as_view(),
|
||||
name='timer-add-quick'),
|
||||
url(r'timer/(?P<pk>[0-9]+)/$', views.TimerDetail.as_view(),
|
||||
name='timer-detail'),
|
||||
|
||||
url(r'tummy-time/$', views.TummyTimeList.as_view(), name='tummytime-list'),
|
||||
url(r'tummy-time/add/$', views.TummyTimeAdd.as_view(),
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.core.urlresolvers import resolve
|
|||
from django.contrib.auth.mixins import (LoginRequiredMixin,
|
||||
PermissionRequiredMixin)
|
||||
from django.views.generic.base import TemplateView, RedirectView
|
||||
from django.views.generic.detail import DetailView
|
||||
from django.views.generic.edit import CreateView, UpdateView, DeleteView
|
||||
from django.views.generic.list import ListView
|
||||
|
||||
|
@ -142,6 +143,12 @@ class SleepDelete(PermissionRequiredMixin, DeleteView):
|
|||
success_url = '/sleep'
|
||||
|
||||
|
||||
class TimerDetail(PermissionRequiredMixin, DetailView):
|
||||
model = Timer
|
||||
template_name = 'timer_detail.html' # To be consistent w/Timer templates.
|
||||
permission_required = ('core.view_timer',)
|
||||
|
||||
|
||||
class TimerAdd(PermissionRequiredMixin, CreateView):
|
||||
model = Timer
|
||||
permission_required = ('core.add_timer',)
|
||||
|
|
Loading…
Reference in New Issue