Re: Singleton model instance

2006-12-07 Thread spacedman
My slightly graceless method is to override .save and .delete: http://groups.google.com/group/django-developers/browse_frm/thread/2caa976249783fae/# Then whatever model you define, it can only ever have one row (well, it will have zero rows before you put anything it). Barry

Re: Re: Singleton model instance

2006-12-07 Thread Phil Powell
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

Re: Singleton model instance

2006-12-05 Thread Jeff Forcier
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

Re: Singleton model instance

2006-12-04 Thread Fredrik Lundh
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 >

Re: Re: Re: Singleton model instance

2006-12-04 Thread James Bennett
On 12/4/06, Phil Powell <[EMAIL PROTECTED]> wrote: > 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

Re: Re: Singleton model instance

2006-12-04 Thread Phil Powell
On 04/12/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > I'm not sure I get how a singleton would solve the "pages generated from > multiple chunks" problem. > > why not just use a model that holds (pagename, chunkname, chunk data) > triplets, and use a view that brings up all the chunks for a

Re: Singleton model instance

2006-12-04 Thread Fredrik Lundh
Phil Powell wrote: > I want to have a series of pages, with certain areas of content which > are editable. I don't want to use flatpages, as I'd like the editable > content to be broken down into chunks, rather than one big lump of > content. > > Is there a way to easily set a model to have