Hi
I have these two models Cart and CartItem,
class Cart(models.Model):
cart_id = models.CharField(max_length=50, null=False)
customer = models.ForeignKey(Customer,null=True,blank=True)
cartitems = models.ManyToManyField(CartItem,null=True)
applied_rule =
models.OneToOneField(CartRule,null=True,blank=True)
class CartItem(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type','object_id')
quantity = models.PositiveIntegerField(default=0)
is_abandoned = models.BooleanField(default=False)
def __str__(self):
return self.cart_id
the rules to be applied only when there are more than two items in
shoppingcart, i.e i am looking for a way to attach a rule to cart only if
there are more than two items in cart (cartitems m2m field should have more
than two objects in it).
How should i go about it ?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.