Opened 16 years ago
Closed 12 years ago
#10293 closed New feature (duplicate)
Show Unicode representations next to ManyToMany raw_id_field
Reported by: | joaoolavo | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.0 |
Severity: | Normal | Keywords: | raw_id_field, manytomanyfield, manytomanyrawidwidget, unicode representation |
Cc: | carlos.palol@…, stan@… | Triage Stage: | Design decision needed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | yes |
Description
Here's what's necessary to be changed to show the Unicode strings of the related objects next to a ManyToMany raw_id_field. Inside file django/contrib/admin/widgets.py, change the method label_for_value() of class ManyToManyRawIdWidget to this one:
def label_for_value(self, value): value = [int(v) for v in value.split(',')] objs = self.rel.to._default_manager.filter(pk__in=value) return ' <strong>%s</strong>' % ', '.join(truncate_words(obj, 14) for obj in objs)
Attachments (1)
Change History (8)
comment:1 by , 16 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:3 by , 13 years ago
UI/UX: | set |
---|
comment:4 by , 13 years ago
Easy pickings: | unset |
---|
See also #7028 re: improving the raw_id_fields widget UI.
comment:5 by , 13 years ago
Cc: | added |
---|
Note:
See TracTickets
for help on using tickets.
Can you please provide this change as a real patch? See the contributing documentation if you need help generating a patch.