One of the features that makes a CMS like WordPress powerful is the ability to add additional fields that may be used in the template. WordPress has what it calls custom fields. Is there a way to do that using Django's flat pages? If not, is there another Django app that will allow page creation with the option of adding additional fields?
+1
A:
You could roll your own version of the flatpages app; take a look at the source code, it's really simple.
It sounds like you could accomplish what you want with two models: one to represent the Pages, and another to represent CustomFields. Tie them together with foreign keys and some inline admin goodness, and you should be set. To access the fields in your template, make sure the Page class implements some kind of lookup function, like __getitem__
.
Justin Voss
2009-04-22 22:27:36
A:
Flatpages are basically just static HTML pages that are stored in your database with a pretty admin interface.
If you need something more complex, it is time to roll your own.
phillc
2009-04-23 22:19:17