I have a custom m2m widget for the admin site. I need to display the names
of the related objects but for the moment I only get the ids of the objects.

Is it possible to get the related objects instead the keys?
How is it implemented in the default widget and the horizontal_filter?
(I took a look to the  code but I got lost)

This is the code for the render method, values only contain a list with the
keys and I need to access the name attribute of the objects.

>     def render(self, name, value, attrs=None):
>         if value is None:
>             value = 'n'
>         final_attrs = self.build_attrs(attrs, type=self.input_type,
name=name)
>         if value != '':
>             final_attrs['value'] = ', '.join(v for v in value])
>         return format_html('<input{0} />', flatatt(final_attrs))


Thanks

-- 
Serge G. Spaolonzi
Cobalys Systems
http://www.cobalys.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to