<reponame>colestevenson/Caelans-Closet-Backend<filename>clothes/models.py
from django.db import models
from django.db.models.deletion import CASCADE

# Create your models here.
class Pieces(models.Model):
    id=models.AutoField(primary_key=True)
    img=models.ImageField(upload_to='images/')
    color=models.CharField(max_length=20)
    colortypes = [
        ('pastel', 'pastels'),
        ('neutral', 'neutrals'),
        ('neon', 'neons'),
        ('jewel tone', 'jewel tones'),
        ('denim', 'denim')
    ]
    colortype=models.CharField(max_length=20, choices=colortypes, default='PT')

    def __str__(self):
        return str(self.id) + ' ' + self.colortype + ' ' + self.color

class Tops(models.Model):
    id=models.ForeignKey(Pieces, on_delete=CASCADE, primary_key=True)
    cropped=models.BooleanField(default=True)
    types = [
        ('strapless', 'strapless'),
        ('sleeveless', 'sleeveless'),
        ('short-sleeved', 'short-sleeved'),
        ('long-sleeved', 'long-sleeved')
    ]
    type=models.CharField(max_length=20, choices=types, default='SS')

    def __str__(self):
        crop_status='not cropped'
        if self.cropped:
            crop_status='cropped'
        return str(self.id) + ', ' + crop_status + ' ' + self.type

class Bottoms(models.Model):
    id=models.ForeignKey(Pieces, on_delete=CASCADE, primary_key=True)
    highrise=models.BooleanField(default=True)
    types = [
        ('pants', 'pants'),
        ('shorts', 'shorts'),
        ('skirt', 'skirt')
    ]
    type=models.CharField(max_length=20, choices=types, default='PT')

    def __str__(self):
        rise_status='lowrise'
        if self.highrise:
            rise_status='highrise'
        return str(self.id) + ', ' + rise_status + ' ' + self.type

class Outerwear(models.Model):
    id=models.ForeignKey(Pieces, on_delete=CASCADE, primary_key=True)
    cropped=models.BooleanField(default=True)
    types = [
        ('cardigan', 'cardigan'),
        ('jumper', 'jumper')
    ]
    type=models.CharField(max_length=20, choices=types, default='CD')

    def __str__(self):
        crop_status='not cropped'
        if self.cropped:
            crop_status='cropped'
        return str(self.id) + ', ' + crop_status + ' ' + self.type

class OnePieces(models.Model):
    id=models.ForeignKey(Pieces, on_delete=CASCADE, primary_key=True)
    types = [
        ('dress', 'dress'),
        ('jumpsuit', 'jumpsuit')
    ]
    type=models.CharField(max_length=20, choices=types, default='DR')

    def __str__(self):
        return str(self.id) + ' ' + self.type

class Jackets(models.Model):
    id=models.ForeignKey(Pieces, on_delete=CASCADE, primary_key=True)
    cropped=models.BooleanField(default=True)

    def __str__(self):
        crop_status='not cropped'
        if self.cropped:
            crop_status='cropped'
        return str(self.id) + ', ' + crop_status

class Shoes(models.Model):
    id=models.ForeignKey(Pieces, on_delete=CASCADE, primary_key=True)
    types = [
        ('boots', 'boots'),
        ('sandals', 'sandals'),
        ('sneakers', 'sneakers'),
        ('other', 'other')
    ]
    type=models.CharField(max_length=20, choices=types, default='SN')

    def __str__(self):
        return str(self.id) + ' ' + self.type