Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #573 -- Added 'Add another' link to many-to-many fields in admi…

…n. Thanks, hp@syntomax.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@714 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 26021249a4e188d855732d800d94f049488e672b 1 parent c1a16d5
Adrian Holovaty authored September 29, 2005

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  django/views/admin/main.py
2  django/views/admin/main.py
@@ -752,7 +752,7 @@ def _get_admin_field_form_widget(field, name_prefix, rel, add, change):
752 752
     # fields with relationships to editable objects get an "add another" link,
753 753
     # but only if the field doesn't have raw_admin ('cause in that case they get
754 754
     # the "add" button in the popup)
755  
-    elif field.rel and isinstance(field.rel, meta.ManyToOne) and field.rel.to.admin:
  755
+    elif field.rel and (isinstance(field.rel, meta.ManyToOne) or isinstance(field.rel, meta.ManyToMany)) and field.rel.to.admin:
756 756
         t.append('{%% if perms.%s.%s %%}' % (field.rel.to.app_label, field.rel.to.get_add_permission()))
757 757
         t.append(' <a href="../../../%s/%s/add/" class="add-another" id="add_%s" onclick="return showAddAnotherPopup(this);">' % \
758 758
                     (field.rel.to.app_label, field.rel.to.module_name, field_id))

0 notes on commit 2602124

Please sign in to comment.
Something went wrong with that request. Please try again.