M
M
mcrack2021-10-09 14:17:29
Django
mcrack, 2021-10-09 14:17:29

How to populate a MultiSelectField in Django?

Hello, there is a MultiSelectField that has a queryset as input.

At the output, I get a drop-down list in which there is a name and id

. The name is formed from the __str__ model method.

So, tell me, is it possible in some particular case to take the value not from __str__, but from another method, or model property.

choices parameter MultiSelectField would not be desirable to use, is there any way to force it to take the name from a specific property?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question