Limitations on new content types

6 views
Skip to first unread message

Barry

unread,
Dec 1, 2010, 2:03:29 PM12/1/10
to django-lfc
Are new content types (subclasses of lfc.models.BaseContent) Django
models with all the CMS stuff mixed in? Can I do almost anything in
the definition of a BaseContent that I can do with a plain Django
model, but then I get permissions and workflow and all the other tabs
for free?

Specific things I'm worrying about are ForeignKey and ManyToManyField
items, linking to other possible BaseContent items and plain Django
models. For example, I want to implement a departmental directory with
Students having a ManyToManyField item to Staff members who are their
supervisors. Then my template for Students will list the supervisors,
and the supervisor's template will list the Students they supervise.
If I make Student and Staff as BaseContent items, can I do this with a
ManyToManyField? And can I customise the admin form to use the neato
'filter_horizontal' widget, or set the radio_fields item to get radio
buttons for choices?

Can BaseContent types inherit sensibly? My non-LFC app has a basic
'Person' class with name, email etc, then Staff and Student are
subclasses of that with extra fields (Staff have a job_title, Student
has year_start for example). Will that all work?

Setting this all up in a non-LFC context is pretty easy, I just wonder
if there may be trouble doing it in LFC. If there's an easier way of
integrating an existing app into LFC than creating all new content
types, then that would be interesting. Could I create one content
type, 'Directory', say, that handled all URLs below it? Then the
personnel data would be managed in the Django admin and just presented
by the Directory content object. Not sure if this is possible, or it
breaks LFCs idea of one URL->one content item...

Other suggestions welcome. I'd like to integrate it into the
templates so as to keep the sense of the navigation, breadcrumbs, and
portlets. I'd have to make a new search view though that did the LFC
search for content and a new Directory search for my other stuff...
Anyway, general ideas on integrating stuff that doesn't really map
neatly into the 'content' paradigm into LFC please!

Barry


Barry

unread,
Dec 2, 2010, 4:45:40 AM12/2/10
to django-lfc
My other approach is to keep the department data in a plain django
app, and have a single content type, DirectoryManager, say, that can
be dropped into the site. This would then have to handle query paths
to present information on users. So, for example,

/department/directory - would show all the people
/department/directory?user=fred - would show fred's staff page
/department/directory?researchgroup=zebras - would show everyone in
the zebra research group

I'm not sure at the moment if content objects can get query string
parameters - would this have to go in the template because the view is
in the hands of lfc? That would be messy. The docs on new content
types only shows how to create the model and the template, not a view.

Apologies if this thread is turning into a personal brain dump, but
easy integration with other database views in a CMS is probably a
common occurrence...

Barry
Reply all
Reply to author
Forward
0 new messages