In general  no, but in this simple usage it is posible. Writing from memory,
the names will be wrong:

class Info(models.Model)
    ...fields

    def article_context_rendered(self):
        t = templates.from_string(self.article_context)
        return t.render({'info':self};

And in the template use info.article_context_rendered. Play with __dict__
for more fun.


On Thu, Feb 18, 2010 at 11:45 PM, Stephan John <em...@stephanjohn.de> wrote:

>  Hi,
>
> I use in the Admin interface the tinymce editor. It is possible to enter
> some template code in the editor which is displayed in the template?
>
> Example:
>
> the view:
>
> def client_info(request):
>
> info = request.META
>
> content = Article.objects.all()
>
> template = loader.get_template('content':content, 'info.html')
>
> context = Context({'info':info})
>
> return HttpResponse(template.render(context))
>
> the template:
>
> {% block info %}
>
> {% for c in content %}
>
> {{ c.article_content }}
>
> {% endfor %}
>
> {%endblock %}
>
> Now I write in a Article in the Admin interface (with tinymce-editor):
>
> Your IP-Address: {{ info.REMOTE_ADDR }}
>
> What can I do so that the code is executed to “Your IP-Address:
> 123.456.789.123” ?
>
> Regards
>
> Stephan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to