Opened 17 years ago
Closed 16 years ago
#6960 closed (fixed)
PositiveSmallInteger comes with unicode value from admin
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | type error nfa-fixed | |
Cc: | Triage Stage: | Fixed on a branch | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If i save this model from admin, the type_x field comes as unicode.
When getting existing instances, the type_x field have int type.
Choices = ( (1,u'a'), (2,u'b') ) class Test(models.Model): type_x = models.PositiveSmallIntegerField(choices=Choices,default=1) def save(self): assert isinstance(self.type_x, int) super(Test,self).save(self) class Admin: pass
Change History (3)
comment:1 by , 17 years ago
Triage Stage: | Unreviewed → Fixed on a branch |
---|
comment:2 by , 17 years ago
Keywords: | nfa-fixed added |
---|
comment:3 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This is no longer a problem since the merge of newforms-admin in [7967].
Note:
See TracTickets
for help on using tickets.
I suspect this has the same root cause as #6853. For some reason when the old manipulator code creates a new object for a field with choices set, the field value is not an integer type but rather the unicode representation of the integer. This is not a problem on newforms-admin.