Answer the question
In order to leave comments, you need to log in
How to display product title in Django admin panel?
How to make it so that the name of this product is displayed instead of the Product object?
Answer the question
In order to leave comments, you need to log in
Define the __str__() method on the model
def __str__(self):
return self.name
Why do you think after the name of the class
CommodityI decided to write the answer in this way?
класс Товар(модели.Модель):
название = модели.ТекстовоеПоле()
№....
опр __стр__(сам):
вернуть "%с".формат(сам.название)
You can also set fields in admin.py in list_display = ('field1', 'field2', etc)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question