Metadata-Version: 2.1
Name: django-string-renderer
Version: 0.1.1
Summary: A thin wrapper around the Django templating system to render any string as a template. It provides an easy way to render any user inputted string as a regular django template.
Home-page: https://github.com/dprog-philippe-docourt/django-string-renderer
Author: Philippe Docourt
Author-email: contact@dprog.net
License: MIT
Description: # django-string-renderer
        A thin wrapper around the Django templating system to render any string as a template. It provides an easy way to render any user inputted string as a regular django template.
        
        # Requirements
        This wrapper uses no models and requires no settings. There is no need to register this app in your INSTALLED_APPS.
        
        This package uses type annotations and mypy to check those annotations.
         
        This package is only tested against Python >= 3.5 and Django >= 1.11.
        
        # Usage
        
        ```python
        import stringrenderer
        
        template_string = "Hello {{ recipient.first_name }} {{ recipient.last_name }}!"
        renderer = StringTemplateRenderer(template_string)
        
        rendered_content = renderer.render_template(context=dict(recipient=recipient_1), request=request)
        rendered_content = renderer.render_template(context=dict(recipient=recipient_2), request=None)
        ```
        
        When the first rendering request occurs on a given `StringTemplateRenderer` instance, a `Template` object is built from the string passed to `__init__()`, and cached for the next rendering operations with other contexts.
        
        You may check the template syntax ike this:
        ```python
        import stringrenderer
        
        template_string = "Hello {{ recipient.first_name }} {{ recipient.last_name }}!"
        is_valid, syntax_error = check_template_syntax(template_string)
        ```
Keywords: templating django
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Framework :: Django
Classifier: Development Status :: 5 - Production/Stable
Classifier: Natural Language :: English
Requires-Python: >=3.5
Description-Content-Type: text/markdown
