Re: How to display Scientific Notation for a field on the admin pages?

2011-08-17 Thread 枯藤天涯
I think you can add a method in the class .when you want to display
the scientific notation on the admin pages ,just call the
instance.method.and  that is ok.

2011/8/5 Jeremy Dunck :
> On Tue, Aug 2, 2011 at 12:32 PM, DjangoOfWar  wrote:
>> Right now I have a Decimal field in my model but I'd like it to
>> display as scientific notation on the admin pages.
>>
>> Do I need to make a custom model field, that uses a custom form field
>> or is there an easier way?
>>
>> (I'm on Django 1.2 if it matters)
>
> What you want is a ModelAdmin which declares formfield_overrides to
> map the model Field to a custom widget:
> https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_overrides
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@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 received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



Re: How to display Scientific Notation for a field on the admin pages?

2011-08-04 Thread Jeremy Dunck
On Tue, Aug 2, 2011 at 12:32 PM, DjangoOfWar  wrote:
> Right now I have a Decimal field in my model but I'd like it to
> display as scientific notation on the admin pages.
>
> Do I need to make a custom model field, that uses a custom form field
> or is there an easier way?
>
> (I'm on Django 1.2 if it matters)

What you want is a ModelAdmin which declares formfield_overrides to
map the model Field to a custom widget:
https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_overrides

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



How to display Scientific Notation for a field on the admin pages?

2011-08-02 Thread DjangoOfWar
Right now I have a Decimal field in my model but I'd like it to
display as scientific notation on the admin pages.

Do I need to make a custom model field, that uses a custom form field
or is there an easier way?

(I'm on Django 1.2 if it matters)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.