add bar setting

This commit is contained in:
James Turk 2015-04-10 17:30:35 -04:00
parent 213e79a20f
commit 2f9fbc4d90
3 changed files with 25 additions and 3 deletions

View File

@ -7,8 +7,8 @@ from django.db import models, migrations
def make_bars(apps, schema_editor): def make_bars(apps, schema_editor):
Bar = apps.get_model('inventory', 'Bar') Bar = apps.get_model('inventory', 'Bar')
Bar.objects.bulk_create([ Bar.objects.bulk_create([
Bar(name="Women's Olympic", weight_kg='15'), Bar(id=1, name="Men's Olympic", weight_kg='20'),
Bar(name="Men's Olympic", weight_kg='20'), Bar(id=2, name="Women's Olympic", weight_kg='15'),
]) ])

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('inventory', '3000_initial_data'),
('lifting', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='liftingoptions',
name='default_bar',
field=models.ForeignKey(default=1, to='inventory.Bar'),
preserve_default=False,
),
]

View File

@ -1,7 +1,7 @@
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField from django.contrib.postgres.fields import ArrayField
from inventory.models import Lift from inventory.models import Lift, Bar
SET_TYPES = ( SET_TYPES = (
('warmup', 'Warmup'), ('warmup', 'Warmup'),
@ -18,6 +18,7 @@ class LiftingOptions(models.Model):
user = models.OneToOneField(User, related_name='lifting_options') user = models.OneToOneField(User, related_name='lifting_options')
lifting_units = models.CharField(max_length=1, choices=UNITS, default='i') lifting_units = models.CharField(max_length=1, choices=UNITS, default='i')
default_bar = models.ForeignKey(Bar)
plate_pairs = ArrayField(models.DecimalField(max_digits=7, decimal_places=3), plate_pairs = ArrayField(models.DecimalField(max_digits=7, decimal_places=3),
default=['45','45','25','10','5','5','2.5','1.25']) default=['45','45','25','10','5','5','2.5','1.25'])