db changes

This commit is contained in:
Girts Graudins 2011-10-05 12:57:56 -07:00
parent e2fcbd8297
commit fcc7fff5c2

View File

@ -2,35 +2,42 @@ from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from datetime import datetime from datetime import datetime
GROUP_CHOICES = (
('forming', 'Forming'),
('negotiating', 'Negotiating'),
('confirming', 'Confirming'),
('closed', 'Closed')
)
class ProductGroup(models.Model): class ProductGroup(models.Model):
url = models.URLField() url = models.URLField()
thumbnail_url = models.URLField()
fullimage_url = models.URLField()
bing_title = models.CharField(max_length=255)
created_by = models.ForeignKey(User, related_name='created_group') created_by = models.ForeignKey(User, related_name='created_group')
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
created_time = models.DateTimeField(default=datetime.now)
description = models.TextField(blank=True) description = models.TextField(blank=True)
state = models.CharField(choices=GROUP_CHOICES, max_length=255)
created_time = models.DateTimeField(default=datetime.now)
end_time = models.DateTimeField() end_time = models.DateTimeField()
negotiation_end_time = models.DateTimeField()
confirmation_end_time = models.DateTimeField()
is_locked = models.BooleanField(default=False) is_locked = models.BooleanField(default=False)
users = models.ManyToManyField(User, blank=True, through='UserGroup') users = models.ManyToManyField(User, blank=True, through='UserGroup')
def __unicode__(self): def __unicode__(self):
return self.name return self.name
TIMELINE_CHOICES = ( TIMELINE_CHOICES = (
('now', 'now'), ('now', 'now'),
('10days', '10 days'), ('10days', '10 days'),
('1month', '1 month') ('1month', '1 month')
) )
class UserGroup(models.Model): class UserGroup(models.Model):
user = models.ForeignKey(User) user = models.ForeignKey(User)
product = models.ForeignKey(ProductGroup) product = models.ForeignKey(ProductGroup)
is_confirmed = models.BooleanField(default=False) is_confirmed = models.BooleanField(default=False)
timeline_of_purchase = models.CharField(choices=TIMELINE_CHOICES, max_length=64) timeline_of_purchase = models.CharField(choices=TIMELINE_CHOICES, max_length=64)
# Create your models here. # Create your models here.