In the Admin I want the user to be able to enter a decimal number with a
percentage sign (eg 33.3%) or without (eg 33.3) and to collect it as a
decimal number.
At the moment DecimalField barfs if the user enters a human style
percentage sign.
My initial thought is to change it to a CharField and muck around making
an awful mess behind the scenes to get - and store - the 0 to 100
decimal value I really want.
On the other hand, there is a snippet ...
https://djangosnippets.org/snippets/1914/
... which looks promising but I'm not sure how to get that into the Admin
I have seen Django Extras has a PercentField but that seems to be a lot
of stuff to solve a small "simple" problem. Also, I haven't seen where
to slip it into the Admin
There is a ticket #17662 (now closed 'wontfix') but that focuses on
doing conversions which isn't what I'm after.
Here is another approach based on the snippet quoted above ...
http://stackoverflow.com/questions/6690692/problem-rendering-a-django-form-field-with-different-representation
... and which draws a suggestion to use a MultiValueField. I didn't try
too hard to understand the Django docs on MultiValueField because if
that is the answer I'm trying to fix the wrong problem.
I just want to ignore the percent sign if the user sticks it into a
DecimalField.
Thanks for any ideas
Mike