I have several flatpages with an empty content field and their contents inside the template (set in the template_name field).
Why am I using django.contrib.flatpages
- It allows me to serve (mostly) static pages with minimal URL configuration.
- I do not need to write submissions for each of them.
Why I Don't Need a FlatPage Model
- I leave the contents empty and just set the template. Therefore, I can use the source in the file;
- I can edit the source directly from the file system without the help of a server (e.g. administrator).
- I can use syntax highlighting and other editor features.
- With the model I have to support fixtures for flatpages.
- Thus, the data for the same object are in two different places.
- If I move the contents inside the device, it will be harder to edit.
- Even if maintenance was not a problem, I would still have to reset and load these lights again and again during development.
What i'm looking for
Basically; get rid of the FlatPage model while maintaining the functionality of contrib.flatpages . I have no clear idea of how this should be resolved. If there is a clean way to modify (e.g. add_to_class ) FlatPages to get information somewhere other than the database, I would prefer this. Perhaps metadata can be inserted into templates, and then a special manager who reads this data will replace the default manager of FlatPages .
If I do not prefer manual editing over admin functions for flatpages, how can I deduce the database from the equation?
python django templates django-flatpages
muhuk
source share