From f277fd56f44043d2d225dd96d8c17b27e4ca26c6 Mon Sep 17 00:00:00 2001 From: Piotr Podusowski Date: Fri, 12 May 2017 19:48:31 +0200 Subject: [PATCH] field added for #20 --- training/migrations/0035_timers.py | 28 ++++++++++++++++++++++++++++ training/models.py | 13 +++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 training/migrations/0035_timers.py diff --git a/training/migrations/0035_timers.py b/training/migrations/0035_timers.py new file mode 100644 index 0000000..1d57763 --- /dev/null +++ b/training/migrations/0035_timers.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2017-05-12 17:47 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('training', '0034_auto_20170312_0953'), + ] + + operations = [ + migrations.CreateModel( + name='Timers', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('time_started', models.DateTimeField(default=None, null=True)), + ('time_finished', models.DateTimeField(default=None, null=True)), + ('excercise', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='training.Excercise')), + ], + options={ + 'ordering': ['pk'], + }, + ), + ] diff --git a/training/models.py b/training/models.py index 23863ad..5f3440b 100644 --- a/training/models.py +++ b/training/models.py @@ -108,6 +108,19 @@ class Meta: ordering = ['pk'] +class Timers(models.Model): + ''' + Timer based excercises tracks time instead of reps. Example + of such workout is plank. + ''' + excercise = models.ForeignKey(Excercise) + time_started = models.DateTimeField(null=True, default=None) + time_finished = models.DateTimeField(null=True, default=None) + + class Meta: + ordering = ['pk'] + + from django.db import models from django.utils.six import with_metaclass