Is there any way to change the string representation of the model just for single StackedInlineAdmin
?
for __str__
def __str__(self):
"""
Return string representation of ApplicationFrom objects.
:return: str
"""
return '{} - {}'.format(str(self.person), dict(FORM_TYPES)[self.form_type])
But I want the last modified date with it as well, just in this inline admin.
For this behavior, I can change the __str__
method of the model to
def __str__(self):
"""
Return string representation of ApplicationFrom objects.
:return: str
"""
return '{} - {} - {}'.format(str(self.person), dict(FORM_TYPES)[self.form_type], get_standard_date_time_format(self.modified_at))
But the old string representation of this model is currently being used in its own admin and other places in codebase well.
What is want is that I should be able to update the string representation of the model just for this admin. We can update the string representation of the model for dropdowns in admin using label_from_instance
by overriding formfield_for_foreignkey
but I can't find a way to update its representation in StackedInlineAdmin.