Commits

Ian Struble  committed d16a8aa

Added basic formatting for list_display of ManyToManyField values.

  • Participants
  • Parent commits b2e63bc

Comments (0)

Files changed (2)

File django/contrib/admin/media/css/changelists.css

     font-size: 11px;
     padding: 1px 2px;
 }
+
+#changelist .results .m2m-changelist {
+    padding: 0;
+    margin: 0;
+}
+#changelist .results .m2m-changelist li {
+    list-style-type: none;
+}

File django/contrib/admin/util.py

         return formats.number_format(value, field.decimal_places)
     elif isinstance(field, models.FloatField):
         return formats.number_format(value)
+    elif isinstance(field, models.fields.related.ManyToManyField):
+        return mark_safe(u'<ul class="m2m-changelist">%s</ul>' % 
+                         "".join([u'<li>%s</li>' % smart_unicode(o) 
+                                  for o in value.select_related()]))
     else:
         return smart_unicode(value)