From 14456ee4f763df50443d4a219ec123b26d6fc462 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Thu, 5 Jan 2017 22:31:02 -0600 Subject: [PATCH] Size should be optional. --- .../migrations/0003_auto_20170105_1405.py | 20 +++++++++++++++++++ bikeshop_project/bike/models.py | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 bikeshop_project/bike/migrations/0003_auto_20170105_1405.py diff --git a/bikeshop_project/bike/migrations/0003_auto_20170105_1405.py b/bikeshop_project/bike/migrations/0003_auto_20170105_1405.py new file mode 100644 index 0000000..3a930f9 --- /dev/null +++ b/bikeshop_project/bike/migrations/0003_auto_20170105_1405.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.4 on 2017-01-05 14:05 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('bike', '0002_auto_20170105_0238'), + ] + + operations = [ + migrations.AlterField( + model_name='bike', + name='size', + field=models.TextField(blank=True, choices=[('C', 'child'), ('M', 'medium'), ('L', 'large'), ('XL', 'extra large')], max_length=2, null=True), + ), + ] diff --git a/bikeshop_project/bike/models.py b/bikeshop_project/bike/models.py index afdb9e5..cf6aec7 100644 --- a/bikeshop_project/bike/models.py +++ b/bikeshop_project/bike/models.py @@ -52,7 +52,7 @@ class Bike(models.Model): colour = models.TextField(blank=False, null=False) make = models.TextField(blank=False, null=False) - size = models.TextField(choices=size_choices, max_length=2) + size = models.TextField(choices=size_choices, blank=True, null=True, max_length=2) serial_number = models.TextField(blank=False, null=False) source = models.TextField(blank=False, null=False, choices=source_choices) stripped = models.NullBooleanField() @@ -72,7 +72,7 @@ class Bike(models.Model): def can_assessed(self): return self.colour is not None and self.make is not None and self.size is not None and self.source is not None \ - and self.price is not None + and self.price is not None and self.size is not None def can_available(self): return self.stolen is not None and self.cpic_searched_at is not None and self.serial_number is not None