formsets, automatically generated from a reusable app foreign key relations
to their section model. Georgeous!
However, the client side javascript is, even after a complete refactoring,
still an utter mess. After the template generates the HTML tree it's a chore
to use javascript to show, hide and duplicate nodes based on user
interaction.
Maybe I should look into client-side templating?
Despite the name, the idea is to allow reusable apps to add any kind of
formset to the edit page. The first test case is to allow madebyjane to
upload multiple images to a section.
Work in progress.
Whe needs CRUD? If a page exists, you edit it. If it doesn't, the same form
creates it. No more sections on a page? It gets automatically deleted. The
only thing the user has to remember is: nothing. Brilliant, right?
No more clicking individual sections to edit them. From now on, there will
only be one edit button! The biggest challenge was getting the javascript
closures to understand.
context, as provided by the polymorphic subsection's registered view.
Also, I'm trying to move all the website-related cruft from cms into the
example project, so that only the Page and Section models with their own
"admin" views will remain.
Each custom section can now have their own associated custom SectionView.
SectionView subclasses behave just like Django's generic views, except they
return Section objects instead of http responses. The updated PageView takes
care of compositing all rendered sections into the final response. Nice!
Oh boy! This is a big one. Two new dependencies: swapper and
django-polymorphic will now allow any project that uses cms to elegantly
extend the default Section model with custom fields and custom subclasses.
This is still a work in progress.
First, extend BasePageView and add stuff to the context that your sections
need. Second, create a URLConf entry pointing to your new class. Third,
extend the base.html nav block and change the {% url cms:page %} to its new
name.
It seems so easy in hindsight...
a functioning Python module without editing settings.py and customizing
the PROJECT_NAME variable.
Also, some small CSS tweaks and a rewrite of README.md
These apps are so minimal they don't warrant their own repository. I'm
hoping they will find a new home here. This move kind of obsoletes the
github.com/rtts/django-numberedmodel and github.com/rtts/django-simplesass
repositories, although I'm not planning to update their documentation unless
I make any major changes here.
Since all of my django projects usually end up with a very similar
structure, I thought it would be useful to include some common settings in
this repository. This is useful for testig the cms app, but also as a
scaffold for new projects. The syntax in settings.py is intentionally
invalid, so you will have to make your desired changes before you can
actually use it.
My personal intended usecase: use this repository as a template for new
projects, edit settings.py and add custom apps.