Hi!
I have model which looks like this.
class Toy(models.Model):
name = models.CharField()
serial_number = models.IntegerField()
...
def __str__(self):
return self.name
class Sales(models.Model):
user = models.OneToOneField('auth.User', )
toys = models.ManyToManyField(Toy, ...)
...
...
/admin.py
class SalesAdmin(admin.ModelAdmin):
fields = ['user', 'toys']
And I added this model to django admin.
The problem is I need to show serial numbers of toys instead of names for this SalesAdmin.
And I do not want to change __str__
method of Toy model since name is more useful in other parts of django admin.
How can I change display string only for this specific admin?
Thanks in advance