﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27239	Unexpected behavior  on get_FIELDNAME_display when as int as value	Levi Velázquez	nobody	"Let's say we have have  a choice field called gender and it has intengers as values.


{{{
    GENDER_CHOICES = (
        (1, _('Male')),
        (2, _('Female'))
    )

gender = models.CharField(choices=GENDER_CHOICES, null=True)
}}}

If we  create an instance with a gender as 1 or '1'  and then try to display gender field value using get_FIELDNAME_display method, we will get unwanted value.  We will get '1' and not 'Male' as it supposed to be. 


{{{
Model.instance.create(gender=1)
instance.get_gender_display()
>>>'1'
}}}
 
The correct response should be 

{{{
Model.instance.create(gender=1)
instance.get_gender_display()
>>>'Male'
}}}


"	Bug	closed	Database layer (models, ORM)	1.10	Normal	duplicate	choice, field		Unreviewed	0	0	0	0	0	0
