0
votes

I'm facing a well known TemplateSyntaxError. It's a widget made using django-autocomplete-light. This is the part of the if statement that's rising TemplateSyntaxError`

<div id="abstract_map" class="tasky_wall_style careers">
    <h1>
        What our interns saying
    </h1>
    <div class="blue_links global_map">
        <div class="review_container">
            {% if selected_layout %}
            {% get_map_layout layout=selected_layout %}
            {% endif %}
        </div>
    </div>
</div>

And the error:

Invalid block tag: 'get_map_layout', expected 'elif', 'else' or 'endif'

I have tried to {% load get_map_layout %} in template but other error is risen 'get_map_layout' is not a valid tag library:....

Can someone help me understand what is going on so I can solve this.

1
Where does the get_map_layout template tag come from? Is it included in the top of your template file? - sthzg
well that is the problem, when I include it I trigger the other not valid tag library error - copser
Have you included the app that defines that tag in INSTALLED_APPS? - Daniel Roseman
Yes, It's included in INSTALLED_APPS - copser
Yes it's a custom widget, here check it out I have pushed it to github.com/Copser/reviews/tree/master/reviews - copser

1 Answers

3
votes

According to the last comment I think you are just loading it by the wrong name. Instead of {% load get_map_layout %} try {% load reviews %} on top of your template.

Django resolves custom template tags through the name of the Python module they are defined in (reviews/templatetags/reviews.py in that case), so {% load reviews %} should make all template tags defined in reviews.py available in your template.