I would like to change the default behavior of how the admin recent changes sidebar displays the name of \"objects\" added. Refer to the picture below:
By adding __str__()
method to the model Patient
this way:
class Patient(models.Model):
name=models.CharField(max_length=200)
#.........
def __str__(self):
return self.name
will display name of patient instead object. For detail check here
You need to define, which column that you want to display...
for example:
class POAdmin(admin.ModelAdmin):
list_display = ('qty', 'cost', 'total')
The string you're seeing is coming from __unicode__
method, as others have mentioned. But the thing is that admin saves string representation of an object when it creates log event, therefore if you add __unicode__
implementation after the log entry was saved, you won't see new titles on old items, only after you make some new activity