> Error is in the way you use it. Please write full model and usage
> example.
As you wish :)
blubb/models.py:
from django.db import models
# Create your models here.
MY_CHOICES = (
(1, '11'),
(2, '12')
)
class TestModel(models.Model):
test_blubb = models.IntegerField(choices=MY_CHOICES)
test_char = models.CharField(choices=MY_CHOICES, max_length=100)
Testcode
./manage.py shell
Python 2.4.4 (#2, Aug 16 2007, 02:03:40)
[GCC 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from blubb.models import *
>>> a = TestModel.objects.get(pk=1)
>>> a.get_test_blubb_display()
u'11'
>>> a.get_test_char_display()
u'2'
Where the last one should be u'12' instead of u'2'. The problem seems
to be with CharField. If I use str for all the choices it does work...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---