Search code examples
djangopython-2.7django-oscar

Display random django oscar products on landing page


Currently my Django Oscar landing page only displays the open menu of product categories. I want to display random products on the landing page, similar to that described in this post, but I don't think promotions are the way to do it. How can I display the products on this page, without using the promotions app? Edit the template?

Tried to associate a promotion with /, but it failed, any help is appreciated.


Solution

  • The solution was to use content blocks from the dashboard. I created a content-block with a url of /. Initially, this was causing an error, but after some searching, THIS post pointed me in the right direction. I had to edit the base oscar apps/dashboard/promotions/forms.py file in my virtual environment, and add

    page_url
    

    to the class Meta fields attribute

    class Meta:
    model = PagePromotion
    fields = ['position', 'page_url']
    

    I was then able to successfully add promotions to the landing page.