Comments (5)
I'm not a good enough programmer to know how to update this app properly, especially being able to provide support for Django 1.7 but in the mean time:
As per the 1.8 release notes, app_namespace/loader.py needs to have two lines fixed:
8 -from django.template.loader import BaseLoader
9 +from django.template.loaders.base import Loader
18 -class Loader(BaseLoader):
19 +class Loader(Loader):
Also, the installation notes need to reflect the new Template system and explicitly add the loaders in the new TEMPLATES setting.
These are the only changes I could see that need doing.
from django-app-namespace-template-loader.
Actually this documentation is insufficient as in Django 1.7:
class BaseLoader(base.Loader):
_accepts_engine_in_init = False
def __init__(self, *args, **kwargs):
Whereas the replacement from Django 1.8:
class Loader(object):
is_usable = False
# Only used to raise a deprecation warning. Remove in Django 2.0.
_accepts_engine_in_init = True
def __init__(self, engine):
self.engine = engine
Discovered via the error:
Exception Type: TypeError
Exception Value: __init__() takes exactly 2 arguments (3 given)
from django-app-namespace-template-loader.
Ok, I've worked this one out and it works.
First, we need to adjust my first change, given the name clash:
from django.template.loaders.base import Loader as L
Then we need to change the call to init, because it has a new shape:
class Loader(L):
"""
App namespace loader for allowing you to both extend and override
a template provided by an app at the same time.
"""
is_usable = True
def __init__(self, engine):
super(Loader, self).__init__(engine)
self._already_used = []
FWIW, I've also updated jquery.js to 2.1.3 and bootstrap to 3.3.4 and it still works fine.
from django-app-namespace-template-loader.
@datakid I have just made a new release (v0.3) enabling the support for Django 1.8.
Note: support for Python 2.6 has been dropped.
Thanks for your participation.
from django-app-namespace-template-loader.
No problems - thanks for your code!
from django-app-namespace-template-loader.
Related Issues (12)
- Support for extending the default template without recursion HOT 2
- App doesn't work with dotted paths in INSTALLED_APPS HOT 3
- Django 1.9 compatibility HOT 5
- Awareness of similar project? HOT 16
- Exception on second render of template when `app_namespace.Loader` is not first. HOT 5
- Unexpected behaviour when using an invalid namespace. HOT 4
- Doesn't work expectantly when use {% extends %} template tag. HOT 7
- Misleading error in namespace violation(?) HOT 1
- Django 3 compatibility
- 'Loader' object has no attribute 'make_origin' HOT 1
- I think it's a bug HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-app-namespace-template-loader.