PDA

View Full Version : Any way to use Django template inheritance with ExtJS?



Mike Stoddart
6 Nov 2012, 10:00 AM
It looks like ExtJS doesn't support declarative markup, which, using Dojo as an example would be:


<div data-dojo-type="demo/SomeWidget"
data-dojo-props="title: 'Our Some Widget'">
<p>This is arbitrary content!</p>
<p>More arbitrary content!</p>
</div>


I'm using Django for my server side logic and I use its template inheritance extensively. I was hoping to use ExtJS's Viewport with north/center/west regions to create a two column base template with a header bar to replace my two_column.html base template I currently have. But this won't be possible by the looks of it. Is there any way to continue using Django's template inheritance or do I need to add code to every single page to instantiate my two column Viewport?

Mike Stoddart
6 Nov 2012, 10:11 AM
To clarify this further:

A base template in Django looks like this:


<html>
<head>
<title>Test</title>


<link rel="stylesheet" type="text/css" href="/static/extern/extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="/static/extern/extjs/ext-all-debug.js"></script>
</head>
{% block content %}
{% endblock %}
</html>


It defines a block that a child template can override:



{% block content %}
This is my page content.
{% endblock %}


Except I want the content block to be located in the Viewport's center region, which seems to be impossible with ExtJS.

Thanks