diff --git a/django/contrib/admindocs/views.py b/django/contrib/admindocs/views.py
index f66ea3e..4f22fe0 100644
a
|
b
|
def model_detail(request, app_label, model_name):
|
214 | 214 | 'help_text': field.help_text, |
215 | 215 | }) |
216 | 216 | |
| 217 | # Gather many-to-many fields. |
| 218 | for field in opts.many_to_many: |
| 219 | data_type = related_object_name = field.rel.to.__name__ |
| 220 | app_label = field.rel.to._meta.app_label |
| 221 | verbose = _("related `%(app_label)s.%(object_name)s` objects") % {'app_label': app_label, 'object_name': data_type} |
| 222 | fields.append({ |
| 223 | 'name': "%s.all" % field.name, |
| 224 | "data_type": 'List', |
| 225 | 'verbose': utils.parse_rst(_("all %s") % verbose , 'model', _('model:') + opts.module_name), |
| 226 | }) |
| 227 | fields.append({ |
| 228 | 'name' : "%s.count" % field.name, |
| 229 | 'data_type' : 'Integer', |
| 230 | 'verbose' : utils.parse_rst(_("number of %s") % verbose , 'model', _('model:') + opts.module_name), |
| 231 | }) |
| 232 | |
217 | 233 | # Gather model methods. |
218 | 234 | for func_name, func in model.__dict__.items(): |
219 | 235 | if (inspect.isfunction(func) and len(inspect.getargspec(func)[0]) == 1): |
… |
… |
def model_detail(request, app_label, model_name):
|
233 | 249 | }) |
234 | 250 | |
235 | 251 | # Gather related objects |
236 | | for rel in opts.get_all_related_objects(): |
| 252 | for rel in opts.get_all_related_objects() + opts.get_all_related_many_to_many_objects(): |
237 | 253 | verbose = _("related `%(app_label)s.%(object_name)s` objects") % {'app_label': rel.opts.app_label, 'object_name': rel.opts.object_name} |
238 | 254 | accessor = rel.get_accessor_name() |
239 | 255 | fields.append({ |