#10229: Can't see values of PositiveSmallIntegerField in admin after adding the
field to list_display.
----------------------------------+-----------------------------------------
 Reporter:  minder                |       Owner:  nobody    
   Status:  new                   |   Milestone:            
Component:  django.contrib.admin  |     Version:  1.0       
 Keywords:                        |       Stage:  Unreviewed
Has_patch:  0                     |  
----------------------------------+-----------------------------------------
 Django 1.0.2, Python 2.5.2
 I have a model with PositiveSmallIntegerField. I added this field to
 list_display in model's admin but I can't see any values in the column,
 only "(None)". I know I can write a simple function to convert the type,
 but this should not be required imho. Strings, dates and boolean are
 handled good - why numbers are not?

 models.py:
 {{{
 from django.db import models

 MEALS=(
 ('0','Own'),
 ('1','1'),
 ('2','2'),
 ('3','3'),
 )

 class Person(models.Model):
         first_name = models.CharField(max_length=20)
         last_name = models.CharField(max_length=30)
         email = models.EmailField()
         meals = models.PositiveSmallIntegerField(default=0, choices=MEALS)
         verified = models.BooleanField()

         def __unicode__(self):
                 return self.first_name + ' ' + self.last_name
 }}}

 admin.py:
 {{{
 from django.contrib import admin
 from myproject.myapp.models import Person


 class PersonAdmin(admin.ModelAdmin):
         list_display = ('first_name', 'last_name', 'email', 'meals',
 'verified',)
         list_display_links = ('first_name', 'last_name',)
         search_fields = ('first_name', 'last_name', 'email',)
         list_filter = ('verified',)

 admin.site.register(Person, PersonAdmin)
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10229>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to