[A] added base.html for timer

This commit is contained in:
Ching 2019-07-09 17:16:57 +08:00
parent e0bb8e78d6
commit 10103c1ab8
4 changed files with 28 additions and 11 deletions

View File

@ -24,4 +24,4 @@ class OfficeHours(models.Model):
@property
def get_ends_at_str(self):
return localtime(self.ends_at).strftime('%Y-%m-%d %H:%M')
return localtime(self.ends_at).strftime('%H:%M')

View File

@ -0,0 +1,7 @@
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
{% block content %}
{% endblock %}
</body>

View File

@ -1,9 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title>Office Hour</title>
</head>
<body>
<h1>office hour ends at: {{ today_oh.get_ends_at_str }}</h1>
</body>
</html>
{% extends 'base.html' %}
{% block content %}
<title>Office Hour</title>
<div>
<h2>office hour ends at: </h2>
<h1>{{ today_oh.get_ends_at_str }}</h1>
</div>
<form method="POST">
{% csrf_token %}
{% for f in form %}
<div class="form-group " >
<label>
{{ f.name }}
</label>
<input type="" name={{ f.name }} class="form-control">
</div>
{% endfor %}
</form>
{% endblock content %}

View File

@ -22,7 +22,6 @@ class OfficeHoursAPI(CreateAPIView):
permission_classes = (permissions.IsAuthenticated,)
queryset = timer.models.OfficeHours.objects.all()
# serializer_class = timer.serializers.GroupSerializer
def create(self, request, *args, **kwargs):
begins_at = request.data.get('begins_at')