class Snippet(models.Model): name = models.CharField() code = models.TextField()
then write a template tag that takes the name of a Snippet, does snippet = Snippet.objects.get(name=name), and outputs the result of Template(snippet.code).render(). Basically you simply have to construct a template object yourself, render it and output the result. Erik On 03.10.2008, at 22:25, Dana wrote: > > Hey All, > > I checked out django-chunks at google code the other day and was > interested in it initially but then realized that I could not inject > actual template code and have it render in the templates. I am > wondering if this is even possible and if so, how could I manage to > accomplish this? For example, Id like to be abel to edit chunks of > code in the Django admin that have Django template code within them > and for that template code to be rendered to the end user. If I had: > > {% for something in something_list %} > <p>{{ something.name }}</p> > {% enfor %} > > How could I manage to have that code editable in the admin, yet have > it display the list of somethings on the front end? > > Thanks for any help! > > Cheers, > Dana > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---