from django.db import models
from django.contrib.auth.models import User

# Create your models here.
class Greeting(models.Model):
    when = models.DateTimeField('date created', auto_now_add=True)


class Material(models.Model):
    name = models.CharField(max_length=200)
    price = models.FloatField(blank=True, null=True)
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)

    def __unicode__(self):
        return self.name

    def __str__(self):
        return self.name


class Bunch(models.Model):
    user = models.ForeignKey(User)
    material = models.ForeignKey(Material)
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)
    image = models.ImageField(upload_to="bunches")
    pounds  = models.FloatField(blank=True, null=True)
    contact = models.CharField(max_length=255)

