I have some flatpages with empty content
field and their content inside the template (given with template_name
field).
Why I am using django.contrib.flatpages
- It allows me to serve (mostly) static pages with minimal URL configuration.
- I don't have to write views for each of them.
Why I don't need the model FlatPage
- I leave the content empty and just supply a template path. Therefore I can take advantage of having the source in a file;
- I can edit the source directly from the file system, without the help of a server (such as admin).
- I can take advantage of syntax highlightning and other editor features.
- With the model I have to maintain fixtures for flatpages.
- So the data for the same entity is in two seperate places.
- If I move the content inside the fixture it'll be more difficult to edit.
- Even if fixture maintenance was a non-issue I'd still need to dump and load these fixtures again and again during development.
What I am looking for
Basically; getting rid of FlatPage
model while maintaining contrib.flatpages
functionality. I don't have a clear idea how this should be solved. If there's a clean way of modifying (like add_to_class
) FlatPages
to get the information somewhere other than the database I'd prefer that. Maybe the metadata can be inserted to the templates and then a special manager that reads this data would replace the default manager of FlatPages
.
If I don't prefer manual editing over admin functionality for flatpages, how can take the database out of the equation?