Ticket #11357: admindocs-m2m-both-ways.diff
File admindocs-m2m-both-ways.diff, 1.4 KB (added by , 15 years ago) |
---|
-
django/contrib/admindocs/views.py
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 = utils.parse_rst((_("all related `%(app_label)s.%(data_type)s` objects") % {'app_label': app_label, 'data_type': data_type}), 'model', _('model:') + data_type) 222 fields.append({ 223 'name': "%s.all" % field.name, 224 "data_type": data_type, 225 "verbose": verbose, 226 "help_text": "", 227 }) 228 217 229 # Gather model methods. 218 230 for func_name, func in model.__dict__.items(): 219 231 if (inspect.isfunction(func) and len(inspect.getargspec(func)[0]) == 1): … … 233 245 }) 234 246 235 247 # Gather related objects 236 for rel in opts.get_all_related_objects() :248 for rel in opts.get_all_related_objects() + opts.get_all_related_many_to_many_objects(): 237 249 verbose = _("related `%(app_label)s.%(object_name)s` objects") % {'app_label': rel.opts.app_label, 'object_name': rel.opts.object_name} 238 250 accessor = rel.get_accessor_name() 239 251 fields.append({