My question is about returning HTML markup in a model method vs. a custom template filter.
In the initial_letter_filter example given in https://docs.djangoproject.com/en/1.5/howto/custom-template-tags/ The function takes in autoescape as an arg, so it knows whether to apply conditional_escape or just lambda x: x (pass-thru) But if I write a model method that returns HTML markup, and I want to call this method in my template, does that method need to know the current auto-escaping state? The only example I see of returning HTML markup in a model method is the colored_name method: https://docs.djangoproject.com/en/1.5/ref/contrib/admin/ It calls format_html() which internally calls conditional_escape....so...it assumes autoescape state is on (unlike the template filter which takes autoescape as an arg) Why does the custom filter need to know the autoescaping state but not the model method? Thanks. -- 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 post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/50e5759c-0150-4b1b-be76-28cc2c86bbe7%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.

