Browse Source

Size should be optional.

feature/bike-tracking
Drew Larson 8 years ago
parent
commit
14456ee4f7
  1. 20
      bikeshop_project/bike/migrations/0003_auto_20170105_1405.py
  2. 4
      bikeshop_project/bike/models.py

20
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),
),
]

4
bikeshop_project/bike/models.py

@ -52,7 +52,7 @@ class Bike(models.Model):
colour = models.TextField(blank=False, null=False) colour = models.TextField(blank=False, null=False)
make = 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) serial_number = models.TextField(blank=False, null=False)
source = models.TextField(blank=False, null=False, choices=source_choices) source = models.TextField(blank=False, null=False, choices=source_choices)
stripped = models.NullBooleanField() stripped = models.NullBooleanField()
@ -72,7 +72,7 @@ class Bike(models.Model):
def can_assessed(self): 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 \ 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): 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 return self.stolen is not None and self.cpic_searched_at is not None and self.serial_number is not None

Loading…
Cancel
Save