is there an easier way of adding the partner name in the product details

60 views
Skip to first unread message

cmmwa...@gmail.com

unread,
Feb 8, 2017, 2:56:50 PM2/8/17
to django-oscar
I am looking to add the partner name and details to the product/catalogue detail page and i noticed a couple of things. The Catalogue model has no relation with the partner class i cannot access it from there and the Selector class used only takes into account pricing, availability and stock record. Is there an easy way of accessing the partner name through the catalogue/detail.html besides having to create another model or view that filters the relationships?

cmmwa...@gmail.com

unread,
Feb 8, 2017, 4:02:04 PM2/8/17
to django-oscar


On Wednesday, February 8, 2017 at 11:56:50 AM UTC-8, cmmwa...@gmail.com wrote:
I am looking to add the partner name and details to the product/catalogue detail page and i noticed a couple of things. The Catalogue model has no relation with the partner class i cannot access it from there and the Selector class used only takes into account pricing, availability and stock record. Is there an easy way of accessing the partner name through the catalogue/detail.html besides having to create another model or view that filters the relationships?



I found a hacky way around it. It consists of using a template tag that filters for the product and returns the partners name. Let me know if anyone needs the code and i can post it up. It would be nice to have a better more convenient way so if anyone has any ideas let me know.

Serdar Gökhan Kaya

unread,
Feb 10, 2017, 2:55:51 PM2/10/17
to django-oscar
{{ product.stockrecords.get.partner.name|upper }} im using this.

8 Şubat 2017 Çarşamba 22:56:50 UTC+3 tarihinde cmmwa...@gmail.com yazdı:

mykl john

unread,
Sep 10, 2017, 11:28:33 PM9/10/17
to django-oscar
I'd love to see the code.  cheers

mykl john

unread,
Sep 19, 2017, 2:49:48 AM9/19/17
to django-oscar

I added a relational index between Product and Partner.

class Product(AbstractProduct):
    partner = models.ForeignKey('partner.Partner', verbose_name=_("Partner"),related_name='productPartner', null=True,blank=True)

Reply all
Reply to author
Forward
0 new messages