Thanks for the input guys. I'm kind of approaching this from a client perspective, so was fishing around for the simplest use case from an inexperienced admin user's point of view.
The suggestions of using a Page and "chunk" schema makes perfect sense, and a quick Google threw up a good example[1]. However, I was kind of missing a trick, as Django's admin provides exactly what I need in the form of user permissions - all I need to do is set up a single intance for a given page model, with the fields defined. Then it's just a matter of changing permissions to only allow client users to edit that instance. Thanks for your help guys - all food for thought. -Phil [1] http://www.carthage.edu/webdev/?p=15 On 05/12/06, Jeff Forcier <[EMAIL PROTECTED]> wrote: > > As James and Fredrik have implied, I believe the proper solution here > is to abstract things enough so that you *can* map the concept to a > relational database; in this case, assuming that every 'Page' has an > identifier, a 'Title' and, perhaps, multiple 'Sections' (each with an > identifier and text), you make a Page model with (unique) Name and > Title attributes, and then a Section or PageSection or etc, model, with > Name and Text fields and a ForeignKey to Page. > > Then your homepage is a Page whose Name is "homepage" and whose Title > is the page title, then with a few Sections: one named "introduction" > with the intro text, one named "footer" with footer text, etc. > > Finally, you'd probably want to make a templatetag that operates on > these models, so you can do something like {% printsection <page> > <section name> %} where <page> is the current Page object, and <section > name> is the name of the section you wish to print. > > So your homepage would looke something like this: > > <html> > <head> > <title>{{ mypage.title }}</title> > </head> > <body> > <h1>{{ mypage.title }}</h1> > <p class="intro">{% printsection mypage "introduction" %}</p> > > <p>stuff goes here</p> > > <p class="footer">{% printsection mypage "footer" %}</p> > </body> > </html> > > I'm sure you can come up with more specific and/or efficient variants > on this theme, but basically this is going down the road that leads to > content management systems, which have solved this basic problem for > some time now :) > > Regards, > Jeff > > Phil Powell wrote: > > > > Perhaps I've not explained myself properly. Here's an example: > > > > I have a "Homepage" which has fields such as "Page Title", > > "Introduction Text", "Footer Text" etc. I want to be able to edit > > these fields just like I'd edit a standard model instance, but because > > there is only one instance of my "Homepage" I never want more than one > > instance of it to exist. > > > > -Phil > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---