You have to implement an URL dispatcher that links an URL to your view.
Read here <https://docs.djangoproject.com/en/dev/topics/http/urls/> and
feel free to ask again if something is still not clear.

Leonardo Giordani
Author of The Digital Cat <http://lgiordani.github.com>
My profile on About.me <http://about.me/leonardo.giordani> - My GitHub
page<https://github.com/lgiordani>- My Coderwall
profile <https://coderwall.com/lgiordani>


2013/10/1 Ricardo <ricardokam...@gmail.com>

> Hi, I have this same problem.
> I'm looking for answer everywhere.
> enemybass could implement?
> If someone can help me with this
>
> [] s
>
> Em quarta-feira, 26 de setembro de 2012 05h33min24s UTC-3, enemybass
> escreveu:
>>
>> https://github.com/bmentges/**django-cart<https://github.com/bmentges/django-cart>
>>
>> *I'm* a total *newbie* to *Django. *How to run method *add_to_car*t? In
>> template I would have button "add to cart".
>>
>> Thanks.
>>
>> 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(Categor**y)
>>
>>     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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@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 the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to