The sample code is below:
REFUND_STATUS = (
('S', 'SUCCESS'),
('F', 'FAIL')
)
refund_status = models.CharField(max_length=3, choices=REFUND_STATUS)
I know in the model I can retrieve the SUCCESS with method get_refund_status_display() method. However, if I want to do it reversely like: I have 'SUCCESS' I want to find the abbreviated form 'S'. How can I do that in django or python?