def add_to_cart(request, product_id, quantity): product = Product.objects.get(id=product_id) cart = Cart(request) cart.add(product, product.unit_price, quantity)
My model look something like this:
class Product(models.Model): name = models.CharField(max_length=50) slug = models.SlugField() unit_price = models.DecimalField(max_digits=5, decimal_places=2) category = models.ManyToManyField(Category) class Meta: verbose_name = "Product" verbose_name_plural = "Products" def __unicode__(self): return self.name
--
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 django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cfabbfd6-01ac-4b40-b887-ea7d7cd59c06%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/M8zey6g_R6s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEhE%2BOkVVp1o5AvtHeDi6U5zsuTKr9swGiJshCh8XwcRfSE_tQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJTdXTFX650QKMe66rz4DRPeEe%3D6iDV2Re894rsuhf6Li82ixg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEhE%2BOkmSBGSbO86OH%2BPc17W2r5PeLOEZdaaWspk8KNMt765mQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJTdXTFB39CfZ9dXiAMaVYuLenkTvXF8r7WL6u3kMrdkY%3DoXog%40mail.gmail.com.
Hi Leonardo. managed to make the implementation of the cart. not used the card but django django carton. There are the same but they are similar. veleu for help. I'm passing the objects by post. Thanks for the help.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEhE%2BOmyRMEUpB_QMxchcqVC6JN3n1PLh%3D2bASEv_T64Fynrog%40mail.gmail.com.