tag_parser/basetags.py
def get_context(self, parent_context, data):
        """
        Wrap the context data in a :class:`~django.template.Context` object.

        :param parent_context: The context of the parent template.
        :type parent_context: :class:`~django.template.Context`
        :param data: The result from :func:`get_context_data`
        :type data: dict
        :return: Context data.
        :rtype: :class:`~django.template.Context`
        """
        if django.VERSION >= (1, 8):
            new_context = parent_context.new(data)
        else:
            settings = {
                'autoescape': parent_context.autoescape,
                'current_app': parent_context.current_app,
                'use_l10n': parent_context.use_l10n,
                'use_tz': parent_context.use_tz,
            }
            new_context = Context(data, **settings)

        # Pass CSRF token for same reasons as @register.inclusion_tag does.
        csrf_token = parent_context.get('csrf_token', None)
        if csrf_token is not None:
            new_context['csrf_token'] = csrf_token

        return new_context
def get_context(self, parent_context, data):
        """
        Wrap the context data in a :class:`~django.template.Context` object.

        :param parent_context: The context of the parent template.
        :type parent_context: :class:`~django.template.Context`
        :param data: The result from :func:`get_context_data`
        :type data: dict
        :return: Context data.
        :rtype: :class:`~django.template.Context`
        """
        if django.VERSION >= (1, 8):
            new_context = parent_context.new(data)
        else:
            settings = {
                'autoescape': parent_context.autoescape,
                'current_app': parent_context.current_app,
                'use_l10n': parent_context.use_l10n,
                'use_tz': parent_context.use_tz,
            }
            new_context = Context(data, **settings)

        # Pass CSRF token for same reasons as @register.inclusion_tag does.
        csrf_token = parent_context.get('csrf_token', None)
        if csrf_token is not None:
            new_context['csrf_token'] = csrf_token

        return new_context
def get_context ( self , parent_context , data ) : if django . VERSION >= ( 1 , 8 ) : new_context = parent_context . new ( data ) else : settings = { 'autoescape' : parent_context . autoescape , 'current_app' : parent_context . current_app , 'use_l10n' : parent_context . use_l10n , 'use_tz' : parent_context . use_tz , } new_context = Context ( data , * * settings ) # Pass CSRF token for same reasons as @register.inclusion_tag does. csrf_token = parent_context . get ( 'csrf_token' , None ) if csrf_token is not None : new_context [ 'csrf_token' ] = csrf_token return new_context
Wrap the context data in a :class:`~django.template.Context` object.

        :param parent_context: The context of the parent template.
        :type parent_context: :class:`~django.template.Context`
        :param data: The result from :func:`get_context_data`
        :type data: dict
        :return: Context data.
        :rtype: :class:`~django.template.Context`
Wrap the context data in a : class : ~django . template . Context object .