Skip to content Skip to sidebar Skip to footer

Override Default Display Of Custom Field In Django Admin Site

I have a custom field which is defined as below: class SeparatedValuesField(models.TextField): __metaclass__ = models.SubfieldBase def __init__(self, *args, **kwargs): sel

Solution 1:

Never mind, I have found the answer here:

https://stackoverflow.com/a/11942954/3870344

Basically, we need to create the custom form, and in the form override the display value by calling: self.initial['some_field'] = some_encoding_method(self.instance.some_field)

Cheers!

Post a Comment for "Override Default Display Of Custom Field In Django Admin Site"