Search code examples
djangojquery-ui-tabs

How do I use JQuery UI tabs with Django (or other tab-solution)?


I would like to use the JQuery UI tabs in my Django app but how should I do that? I cannot figure it out with Django's template system.

Or, is it another smoother way to get tabs in a Django app?

Thanks /Tobbe


Solution

  • Tobbe,

    This is how I'm doing it, may not be ideal, but it works:

    Create a base.html file with all the common html elements you need. Then have blocks that define different parts of the file. For instance:

    <HTML>
    <HEAD><TITLE>My Page</TITLE></HEAD>
    <BODY>
    {% block tabs %}
    Put your tab code here. The content is actually in the tab block that is why the endblock for the tabs block is after the content block.
    {% block content %}Default content{% endblock content %}
    {% endblock tabs %}
    </BODY>
    </HTML>