"registry". Client projects register their models and views during import
time with a decorator. The cms views use the registered classes to generate
pages and forms.
Furthermore, the example application now combines the app and the project in
one, inspired by this line in the Django documentation:
There’s no restriction that a project package can’t also be considered
an application and have models, etc.
you to define everything related to it in the file 'cms.py'. No more
inherited proxy models and no more migrations every time you add/remove a
section type! In fact, the dependency on django-polymorphic has completely
been removed!
The example project has been updated and should get you started.
Documentation will be coming soon!
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?
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...
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.