El Tue, 15 Sep 2009 11:38:56 -0400
Randy Barlow <rbar...@americanri.com> escribió:

> > Do you have any example / documentation?
> 
> I don't have a very concrete example, but the high level thinking is
> pretty easy to write out.  Typically, you would store your templates in
> some kind of templates directory on the file system.  This doesn't work
> well for your problem, as you want Admin type people to be able to edit
> the templates, and you might even want some kind of revision control on
> them.
> 
> Instead, you can make a table in your DB in which to stuff the
> templates.  Maybe something like this:
> 
> class WebTemplate(models.Model):
>       template = models.TextField()
>       version = models.PositiveIntegerField(unique=True)
>       # Use this to store which page the template is for, like 'home'
>       page = models.CharField(max_length=<some_length>)
> 
> When you create your template object, make it from the text in the
> template field, and look for the entry with the highest version.  When
> somebody edits the template, you just create a new instance and
> increment the version number.  Make sense?  If you don't need revision
> control, then you can simplify this, but I think it's pretty simple as is!

Or.. you could just use django-dbtemplates[0].

[0] http://bitbucket.org/jezdez/django-dbtemplates/wiki/Home

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/

Attachment: pgphfgCNdAEvJ.pgp
Description: PGP signature

Reply via email to