Metadata-Version: 1.1
Name: django-chang
Version: 0.1.0
Summary: Simple Django utility library including a Jinja2 connection
Home-page: https://github.com/NiklasRosenstein/django-chang
Author: Niklas Rosenstein
Author-email: rosensteinniklas@gmail.com
License: MIT
Download-URL: https://github.com/NiklasRosenstein/django-chang
Description: # django-chang
        
        Chang is a utility library that I use when developing Django applications. It
        comes with Jinja2 for Django (which is highly inspired by [django-jinja][])
        and a few other utilities.
        
        ### chang.jinja2
        
        The Jinja2 connection provided by *chang* provides a `{% csrf_token %}`
        that which can be used in the Jinja2 templates. The `CHANG_JINJA2_VERIFY`
        setting is used to determine whether a template should be loaded via
        the Jinja2 Environment. It must be a callable object that accepts the
        template name as a parameter.
        
        `CHANG_JINJA2_ALWAYS` can be set to True to always load templates as
        Jinja2 templates.
        
        Make sure you add `chang.jinja2.FileSystemLoader` and/or
        `chang.jinja2.AppDirectoriesLoader` before the Django default template
        loaders.
        
        ### chang.local
        
        Provides a Django Middleware that makes the Django request object
        available as a LocalProxy which can be accessed via `chang.local.request`
        or `chang.request`. Using this removes the requirement to pass the
        Django request to each function that requires it.
        
        ```python
        # settings.py
        MIDDLEWARE_CLASSES = (
            # ...
            'chang.local.Middleware',
        )
        
        # views.py
        from chang.local import request
        ```
        
        ### chang.utils
        
        The `TemplateRenderer` can be used as a decorator for functions that build
        a default context for rendering templates. You can put it in your `views.py`
        like this:
        
        ```python
        from django.utils import timezone
        from chang.utils import TemplateRenderer
        
        @TemplateRenderer
        def render(context):
            context.update({
                'time': timezone.now(),
            })
        
        def home(request):
            render(request, 'my_app/home.html')
        ```
        
        ## License and Copyright
        
        The `chang.jinja2` module is highly inspired by [django-jinja][].
        
        * __Author__: Niklas Rosenstein
        * __License__: MIT
        
          [django-jinja]: https://github.com/niwibe/django-jinja
        
        
        
Platform: Any
Classifier: Development Status :: 5 - Production/Stable
