Re: Change display of (None) in admin change lists?

2010-02-18 Thread rebus_
On 18 February 2010 15:12, Derek  wrote:
> Is there a way to alter the display of fields in the Django Admin change
> lists so that they do not show (None) - for text - or None - for numeric.
>
> I'd prefer to use " " or "-" for display of items instead.
>
> Thanks
> Derek
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

You could create custom methods on Model and use them in ModelAdmin
list_display instead of real fields.

Read more here:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

You could even create these methods in runtime with setattr in
__init__ for example, but be careful though, if you "curry" your
methods there's a good chance you'll have problems serializing them
(but this can be taken care of by defining __getstate__ and
__setstate__ methods).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Change display of (None) in admin change lists?

2010-02-18 Thread Derek
Is there a way to alter the display of fields in the Django Admin change
lists so that they do not show (None) - for text - or None - for numeric.

I'd prefer to use " " or "-" for display of items instead.

Thanks
Derek

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.