Code

Ticket #573: add_+_to_ManyToMany.diff

File add_+_to_ManyToMany.diff, 949 bytes (added by anonymous, 9 years ago)
Line 
1Index: django/views/admin/main.py
2===================================================================
3--- django/views/admin/main.py  (revision 712)
4+++ django/views/admin/main.py  (working copy)
5@@ -752,7 +752,7 @@
6     # fields with relationships to editable objects get an "add another" link,
7     # but only if the field doesn't have raw_admin ('cause in that case they get
8     # the "add" button in the popup)
9-    elif field.rel and isinstance(field.rel, meta.ManyToOne) and field.rel.to.admin:
10+    elif field.rel and isinstance(field.rel, meta.ManyToOne) or isinstance(field.rel, meta.ManyToMany) and field.rel.to.admin:
11         t.append('{%% if perms.%s.%s %%}' % (field.rel.to.app_label, field.rel.to.get_add_permission()))
12         t.append(' <a href="../../../%s/%s/add/" class="add-another" id="add_%s" onclick="return showAddAnotherPopup(this);">' % \
13                     (field.rel.to.app_label, field.rel.to.module_name, field_id))