I would create a table with 2 columns as a key, value pair and set the
key to be unique. That way, a setting could not be duplicated. Yet,
you could add as many different settings as you want without altering
the model at any point in the future. I suppose one could then add
invalid/non-existent s
As far as I know, there's no way to restrict the number of instances
of a particular model. You could hack the admin templates to hide
"Add" buttons if an instance of a particular model already exists. Or
override the save method in the model so that it doesn't save if an
instance already exists
I need a model called settings that has some application settings the
user can edit in the admin. How should I set this model up so that one
and only one settings record always exists for the lifetime of the
application.
Also, please let me know if this approach is incorrect.
--~--~-~-
3 matches
Mail list logo