You could make such a check and deny the saving of a new FrontPage
object by overloading the save() method of class FrontPage.
Source in trunk: django/db/models/base.py.
Regards, James.
Why?
The really proper way to do that is to store the sole FrontPage model
in a json file, the file-system is better suited than a RDBMS to store
one single instance of a single structure IMHO.
> I'll give the user permission to change a FrontPage instance but not
> delete or add one. The real admin user
> will have just to avoid adding / deleting but this user ain't used
> (much). In the FrontPage view I can check
> that the original view is being used (perhaps by looking for pk==1 or
> something). The main thing is that this
> switches off the admin template buttons 'x delete' '+add' etc.
You might also overload default admin templates for FrontPage, but
permissions allow security.
> What I was looking for was a global permission that could be set on a
> model when it was defined which set
> default permissions for 'staff' on the model (or even for superuser)
> on that model.
Why not just create another group?
Don't forget to save your permissions in
yourapp/data/initial_data.json with the help of the dumpdata
management command, since it's consistence critical.
Regards, James.
Very relevant, don't forgot to overload the save method to set
other is_active to 0!
Regards, James.