From b1952b96f7a7d0972010e9886a18d0f3101bc6b3 Mon Sep 17 00:00:00 2001 From: Tom Price Date: Tue, 15 Sep 2015 17:25:11 +0100 Subject: [PATCH] Change supplier and abstract model to match the design agreed in the office. --- assets/models.py | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/assets/models.py b/assets/models.py index a9086efe..381a7519 100644 --- a/assets/models.py +++ b/assets/models.py @@ -1,13 +1,34 @@ from django.db import models import reversion + # Create your models here. class Suppliers(models.Model): - name = models.CharField(max_length=100) - address = models.TextField() - phone = models.CharField(max_length=13, null=True, blank=True) - company_number = models.IntegerField() + name = models.CharField(max_length=100) -class AbstractAsset(object): - purchase_cost = models.DecimalField(max_digits=10, decimal_places=2) - purchase_date = models.DateField(blank=True, null=True) + +class AbstractAsset(models.Model): + STATUS_LOST = 1 + STATUS_ACTIVE = 2 + STATUS_INACTIVE = 3 + STATUS_BROKEN = 4 + STATUS_SCRAPPED = 5 + STATUS_NOT_BUILT = 6 + STATUS_SOLD = 7 + + STATUS_CHOICES = ( + (STATUS_LOST, 'Lost'), + (STATUS_ACTIVE, 'Active'), + (STATUS_INACTIVE, 'Inactive'), + (STATUS_BROKEN, 'Broken'), + (STATUS_SCRAPPED, 'Scrapped'), + (STATUS_NOT_BUILT, 'Not Yet Built'), + (STATUS_SOLD, 'Sold'), + ) + + status = models.IntegerField(choices=STATUS_CHOICES) + notes = models.TextField(blank=True, null=True) + # test_period # decide what to do with this later + + class Meta: + abstract = True