From fc503cccf5b0c54699337a839c528c9ba9022fc6 Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 16 Sep 2011 23:33:24 +0530 Subject: [PATCH] initial models file --- trubox/deals/models.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/trubox/deals/models.py b/trubox/deals/models.py index 71a8362..6b5bb04 100644 --- a/trubox/deals/models.py +++ b/trubox/deals/models.py @@ -1,3 +1,33 @@ from django.db import models +from django.contrib.auth.models import User + + +class ProductGroup(models.Model): + url = models.URLField() + created_by = models.ForeignKey(User) + name = models.CharField(max_length=255) + description = models.TextField(blank=True) + end_time = models.DateTimeField() + is_locked = models.BooleanField(default=False) + users = models.ManyToManyField(User, blank=True, through='UserGroup') + + def __unicode__(self): + return self.name + + +TIMELINE_CHOICES = ( + ('now', 'now'), + ('10days' '10 days'), + ('1month', '1 month'), +) + +class UserGroup(models.Model): + user = models.ForeignKey(User) + product = models.ForeignKey(ProductGroup) + is_confirmed = models.BooleanField(default=False) + timeline_of_purchase = models.CharField(choices=TIMELINE_CHOICES) + + + # Create your models here.