3👍
✅
Return the right context from the form page view.
This is the context sent to flatpages’ template (where f is the flatpage instance)
f.title = mark_safe(f.title)
f.content = mark_safe(f.content)
c = RequestContext(request, {
'flatpage': f,
})
in your view you can easily return a (unsaved) flatpage instance with all attrs you need.
f = FlatPage()
f.title = ""
f.content = ""
....
c = RequestContext(request, {
'flatpage': f,
})
0👍
If you are going to be using forms, then you don’t need to use flatpage – use a regular view with the flatpage template, and RequestContext as your context.
- [Django]-What is the best method to upgrade a django project from 1.3.7 to 1.6 or 1.7
- [Django]-Django data migration – class variable unavailable via get_model()
- [Django]-Django redirect inside a function
- [Django]-What's your favorite way to test the javascript in your djangoapp?
Source:stackexchange.com