Block content - what is it?

35 views
Skip to first unread message

Max

unread,
Jan 10, 2018, 3:39:06 AM1/10/18
to django-oscar
Hi guys, i tried to rewrite block content, but if the block name is content then template inheritance did not work. Please, tell me what is it ... I checked the comment "that block for AJAX" ...

Max

unread,
Jan 10, 2018, 3:50:17 AM1/10/18
to django-oscar
for example.. {% block layout%} {%block_wrapper %} {% block content %}
layout 2 inherit from base layout, browse template <- layout 2. if rewrite block content in latest block then content will be empty. I changed name ..and it works..
Thanks!

Samir Shah

unread,
Jan 10, 2018, 10:22:04 PM1/10/18
to django-oscar
As the comment hints at, that block is used for dynamic updates to the content. As far as I know it is only used on the basket view - see https://github.com/django-oscar/django-oscar/blob/efc9eea895a29bca98de6451725bc4cc0ba61060/src/oscar/static/oscar/js/oscar/ui.js#L170 .

I don't know why your inheritance wouldn't work though (it should work just fine) - we would need to see your whole template to work out if there is an issue with how you are inheriting.

Max

unread,
Jan 11, 2018, 9:56:43 AM1/11/18
to django-oscar
Samir, thanks for response. I used default template... I inherited my base.html template from oscar base.html.(I checked that content section does not exists in this template - only layout). I rewrited some things - only scripts/styles/cdn_scripts( if rewrite cdn_scripts admin did not work - is really fun moment...i think all parts of admin must be in local storage.. because we will have many conflicts if we will use other jquery version of lib...) And then i created custom layout (only clean default layout.html/layout_2.html)...Tree was the same as original template... I did not save old version.. so i try to manully..
in layout.html
{% block content_wrapper %}{%content %}empty{%endblock%}{%endblock%}
in layout2_html {% block content_wrapper %}{%content %}content{%endblock%}{%endblock%}
and in browse.html we also change content section...also i tried to use block.super but it did not work when content had name "content"....I thought maybe ajax rewrite this part of template to empty...
tree
oscar-base.html
   base.html
      layout.html
         layout2_col.html
            browse.html
четверг, 11 января 2018 г., 6:22:04 UTC+3 пользователь Samir Shah написал:

Samir Shah

unread,
Jan 12, 2018, 12:18:28 AM1/12/18
to django-oscar
The JS doesn't empty that block as far as I am aware (you can verify this by just disabling JS to confirm).

I would bet that the issue is with your templates - i.e., something is not right with the template structure or content. It's hard to help you more without seeing the templates though. What you have posted below incomplete and has a number of errors which make it hard to follow (e..g, .layout2_html vs  layout2_col vs layout_2_col.html - only the last of these is used by Oscar).


Max

unread,
Jan 30, 2018, 4:49:29 AM1/30/18
to django-oscar
Thank you very much.I rewrote templates :) It was more quickly.
Reply all
Reply to author
Forward
0 new messages