I meant to write "indeed this section of the same article seems to support 
this - 
https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/#auto-escaping-considerations
"

On Sunday, November 24, 2019 at 6:43:44 PM UTC, Ross wrote:
>
> To create our own custom template tags we have to define a Node subclass 
> which implements a render method.
>
> Example from 
> https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/#auto-escaping-considerations
>
> import datetimefrom django import template
> class CurrentTimeNode(template.Node):
>     def __init__(self, format_string):
>         self.format_string = format_string
>
>     def render(self, context):
>         return datetime.datetime.now().strftime(self.format_string)
>
>
>
>
> It seems the context parameter for the render function is a 'context object' 
> and not a 'request context object'.  Indeed this section of the same article 
> seems to support this - To create our own custom template tags we have to 
> define a Node subclass which implements a render method.
>
>
> Anyway when I followed the example and printed the context object it looks to 
> be a request object.  Is this a bug?  I'm using the latest django.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52ae367c-7f59-40f8-9fa6-2676c48b4934%40googlegroups.com.

Reply via email to