Unanswered
Can I inherit templates?
You sure can!
Python classes:
- class MyBaseForm
- class MyInheritedForm(MyBaseForm)
- class MyInheritedFormTwo(MyBaseForm)
Directory structure
- my_base_form
---- extension.py
---- templates
-------- index.html - my_inherited_form
---- extension.py
---- templates - my_inherited_form_two
---- extension.py
---- templates
-------- index.html
Let's say we called:
self.get_template('index.html', {})
From:
MyBaseForm: returns my_base_form/templates/index.html
MyInheritedForm: returns my_base_form/templates/index.html (inherited)
MyInheritedFormTwo: returns my_inherited_form_two/templates/index.html (overridden)
115 Views
0
Answers
5 years ago
5 years ago
Tags