summaryrefslogtreecommitdiff
path: root/django/views
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-09-29 03:19:14 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-09-29 03:19:14 +0000
commit26021249a4e188d855732d800d94f049488e672b (patch)
tree647613d75fd9641e8a86613ccb6490c9e45578c1 /django/views
parentc1a16d54b0fce2ffe89eab9a69e689f87a4c1ddc (diff)
Fixed #573 -- Added 'Add another' link to many-to-many fields in admin. Thanks, hp@syntomax.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@714 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/views')
-rw-r--r--django/views/admin/main.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/views/admin/main.py b/django/views/admin/main.py
index e39f25c564..a6109a46cd 100644
--- a/django/views/admin/main.py
+++ b/django/views/admin/main.py
@@ -752,7 +752,7 @@ def _get_admin_field_form_widget(field, name_prefix, rel, add, change):
# fields with relationships to editable objects get an "add another" link,
# but only if the field doesn't have raw_admin ('cause in that case they get
# the "add" button in the popup)
- elif field.rel and isinstance(field.rel, meta.ManyToOne) and field.rel.to.admin:
+ elif field.rel and (isinstance(field.rel, meta.ManyToOne) or isinstance(field.rel, meta.ManyToMany)) and field.rel.to.admin:
t.append('{%% if perms.%s.%s %%}' % (field.rel.to.app_label, field.rel.to.get_add_permission()))
t.append(' <a href="../../../%s/%s/add/" class="add-another" id="add_%s" onclick="return showAddAnotherPopup(this);">' % \
(field.rel.to.app_label, field.rel.to.module_name, field_id))