from django.db import models

from settings import PARENT_SEPARATOR


class Page(models.Model):
    headline = models.CharField(max_length=255)
    slug = models.CharField(max_length=50, unique=True)
    parent = models.ForeignKey('self', blank=True, null=True, limit_choices_to={})
    content = models.TextField(blank=True)
    public = models.BooleanField(default=True)
    is_template = models.BooleanField(default=False)

    def get_full_slug(self):
        slug = self.slug
        if self.parent != None:
            parent = self.parent
            while parent is not None:
                slug = parent.slug + PARENT_SEPARATOR + slug
                parent = parent.parent
        return slug

    def __unicode__(self):
        return self.headline

@@ -21,16 +21,62 @@
 t models
+%0Afrom django.template import Context, Template
 %0A%0Afrom s
@@ -744,16 +744,268 @@
 n slug%0A%0A
+    def render(self, context=None):%0A        if self.is_template:%0A            template = Template(self.content)%0A            if context is None:%0A                context = Context()%0A            return template.render(context)%0A        return self.content%0A%0A
     def 

add render method to model to render content as template if is_template is true