Code Monkey home page Code Monkey logo

Comments (5)

lachlansimpson avatar lachlansimpson commented on August 20, 2024

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.

lachlansimpson avatar lachlansimpson commented on August 20, 2024

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.

lachlansimpson avatar lachlansimpson commented on August 20, 2024

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.

Fantomas42 avatar Fantomas42 commented on August 20, 2024

@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.

lachlansimpson avatar lachlansimpson commented on August 20, 2024

No problems - thanks for your code!

from django-app-namespace-template-loader.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.