I have an artist which has many paintings, so a many to one relation. So i got
class Artist(models.Model):
name = models.CharField(max_length=120)
age = models.IntField()
class Paintings(models.Model):
painting = models.ImageField()
painting_name = models.CharField(max_length=120, default='', null=True)
artist = models.ForeignKey(
'Artist',
related_name='paintings',
on_delete=models.CASCADE,
verbose_name= 'Künstler'
)
Now if I'll create a new Painting rely to an artist it doesnt show me the exact name of the artist, just the artist object [id]
inside my admin.py
I try to define
artist = Artist.name
list_display = ('image_tag', artist, 'painting_name')
but this is not allowed. So how can I replace the Artist Object (id) with the actual name
of the artist?