Django Admin – Disable the Add action for a specific model
|November 10, 2010||Posted by forumadmin under TechQns||
I have a django site with lots of models and forms. I have many custom forms and formsets and inlineformsets and custom validation and custom querysets. Hence the add model action depends on forms that need other things, and the ‘add model’ in the django admin throughs a 500 from a custom queryset.
Is there anyway to disable the ‘Add $MODEL’ functionality for a certain models?
/admin/appname/modelname/add/ to give a 404 (or suitable ‘go away’ error message), I don’t want the ‘Add $MODELNAME’ button to be on
Django admin provides a way to disable admin actions (http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#disabling-actions) however the only action for this model is ‘delete_selected’. i.e. the admin actions only act on existing models. Is there some django-esque way to do this?
|Asked By – Rory||Read Answers|