'BlockNode' object has no attribute 'context'

随声附和 提交于 2019-12-07 20:55:51

问题


I am new to django/python. I am trying out Pagination on scroll using django-endless-pagination and found the below error: 'BlockNode' object has no attribute 'context'

entry_index.html

<h2>Logs:</h2>
{% include page_template %}
{% block js %}
{{ block.super }}
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="{{ STATIC_URL }}endless_pagination/js/endless-pagination.js"></script>
<script>
    $.endlessPaginate({
        paginateOnScroll: true,
        paginateOnScrollChunkSize: 5
    });
</script>
{% endblock %}

entry_index_page.html

{% for i in list %}
    {{ i }}
{% endfor %}

I am following Django Endless Pagination tutorial for this.

Any help would be greatly appreciated.


回答1:


{% include page_template %}
    {% block js %}
        <script src="http://code.jquery.com/jquery-latest.js"></script>
        <script src="{{ STATIC_URL }}endless_pagination/js/endless-pagination.js"></script>
        <script>$.endlessPaginate();</script>
    {% endblock %}

I used code like this in template instead of code shown in below.. Then it worked...

{% include page_template %}
{% block js %}
    {{ block.super }}
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script src="{{ STATIC_URL }}endless_pagination/js/endless-pagination.js"></script>
    <script>$.endlessPaginate();</script>
{% endblock %}


来源:https://stackoverflow.com/questions/19143589/blocknode-object-has-no-attribute-context

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!