lifting app w/ basic models

This commit is contained in:
James Turk 2015-03-31 17:25:19 -04:00
parent ae7fc7daa9
commit bd39151d95
6 changed files with 55 additions and 0 deletions

0
lifting/__init__.py Normal file
View File

3
lifting/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Exercise',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=200)),
],
),
migrations.CreateModel(
name='Set',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('date', models.DateField()),
('weight_kg', models.DecimalField(max_digits=7, decimal_places=3)),
('reps', models.PositiveIntegerField()),
('source', models.CharField(max_length=100)),
('exercise', models.ForeignKey(to='lifting.Exercise', related_name='sets')),
],
),
]

View File

18
lifting/models.py Normal file
View File

@ -0,0 +1,18 @@
from django.db import models
SET_TYPES = (
('warmup', 'Warmup'),
('planned', 'Planned'),
)
class Exercise(models.Model):
name = models.CharField(max_length=200)
class Set(models.Model):
date = models.DateField()
exercise = models.ForeignKey(Exercise, related_name='sets')
weight_kg = models.DecimalField(max_digits=7, decimal_places=3)
reps = models.PositiveIntegerField()
source = models.CharField(max_length=100)

3
lifting/views.py Normal file
View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.