I looked into it after my first reply and my suggestion was wrong.

If you want to display the value of a foreign key object's property in
the admin page to select an object to change, you can add a callable
to list_display.
For exemple, ` list_display = ('title', lambda o: getattr(o.author,
"name", "-"),) `. The callable will get one argument, an instance of
the model.

If you want to display a field to change a property of a foreign key
object, I haven't found a way. Best option might be a inline model
admin.

2016-09-19 12:24 GMT+02:00 RompePC <durillo19942...@gmail.com>:
> Hi again, I didn't have time to try it until now, but I just realized that
> maybe I asked the wrong way. What I wanna do is to render the widget
> associated to that FK in the panel, not its name. So I need to pass the
> field or its rendered content to the context, but I don't know how to do get
> it.
>
> El viernes, 16 de septiembre de 2016, 13:59:26 (UTC+2), ludovic coues
> escribió:
>>
>> Have you tried something like author__name ? Assuming a model with an
>> author foreign key.
>>
>> 2016-09-16 8:56 GMT+02:00 RompePC <durillo...@gmail.com>:
>> > I would like to pass to the list display view a FK field of the admin
>> > form
>> > (like the ones when adding a new row). But I don't see the way of doing
>> > it,
>> > although I've searched along many properties of the model admin to get
>> > it.
>> >
>> > Anyone did something like that before?
>> >
>> > --
>> > 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...@googlegroups.com.
>> > To post to this group, send email to django...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/django-users/d4cfbc3a-8668-4576-8d5c-c04cdd0eb1b2%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>>
>> Cordialement, Coues Ludovic
>> +336 148 743 42
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a99dac72-a527-4968-92f5-0a4c405c1778%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTar-rUXwSoZgTMfeAYtRb6Ji-j_zjSKZDmRGEAP4Gs2cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to