#9071: Can't disable "add" popup links in the admin
-------------------------------+------------------------------------
     Reporter:  jacob          |                    Owner:  burzak
         Type:  New feature    |                   Status:  assigned
    Component:  contrib.admin  |                  Version:  1.0
     Severity:  Normal         |               Resolution:
     Keywords:  pyconuk        |             Triage Stage:  Accepted
    Has patch:  1              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  1
Easy pickings:  0              |                    UI/UX:  1
-------------------------------+------------------------------------

Comment (by rhunwicks):

 For others that end up on this page as the result of a Google Search or
 similar, as described on http://stackoverflow.com/questions/10377642/how-
 to-use-can-add-related-in-django-admin, the full version of the "Using the
 `ModelAdmin.get_form hook`" comment is:

 {{{#!python
 class ProductAdmin(ModelAdmin):

     def get_form(self, request, obj=None, **kwargs):
         """
         Don't allow adding new Product Categories
         """
         form = super(ProductAdmin, self).get_form(request, obj, **kwargs)
         form.base_fields['category'].widget.can_add_related = False
         return form
 }}}

 Given the simplicity of this, do we still need this ticket?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/9071#comment:24>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.0eda7a806779cfd25e79ef67290719b9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to