Custom Display Methods
Custom Display Methods offer a way to present information in tables in a more user-friendly or meaningful manner. Custom display methods serve the purpose of altering the displayed value of a specific column, diverging from its original database value. This section provides insights into defining and implementing these custom display methods to enhance user experience.
When implementing a custom display method, replace <table_column_name> with the name of the specific column you aim to customize. Within this method, apply the necessary logic to modify the obj value and return the desired final_value. This modified value will then be displayed in the table for the respective column.
Parameters
- self: Refers to the instance of the class, allowing access to its attributes and methods.
- obj: Represents the object (record) being displayed in the current row. This parameter holds the original database value associated with the column.
Return Value
- final_value: The value returned by the custom display method. This value will be displayed in the table for the respective column after any necessary modifications or processing based on the logic implemented within the method.
Method structure
def <table_column_name>_getval(self, obj):
# Implement logic to manipulate obj value
return final_value