I wanted a way to store 'properties' - single values over an app (or project) that control the apps behaviour, for example a title to appear on the page, or whether to display threads expanded or not in a forum. I thought it would be nice to have these settings configurable from the Admin interface, rather than editing a settings.py file.
So I discovered if you override 'save' and 'delete' in your model with: def save(self): self.id=1 super(mySettings, self).save() def delete(self): pass then if you add a new row it just replaces the id=1 row, and if you delete a row, nothing happens. If you create the row using the initial SQL feature then you can be (almost) sure that there's only ever one row in the table. Then when your view code needs to get a value, it just queries the mySettings table and gets it. Seems kinda neat, but obviously some people may be confused when 'add mySetttings' doesnt actually add anything, and 'delete' doesnt actually delete it. Would there be enough demand for this kinda thing to make it a separate class of model, such that you could do: class mySettings(models.Properties): and then tweak the admin screens slightly to compensate for the different behaviour? Barry --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~----------~----~----~----~------~----~------~--~---