Re: Creating a new field type

2006-07-24 Thread adurdin
One other side effect of the problem noted in my message above is this: If I enter "1e5" in the text field, it fails validation (as I'm limiting it to -?\d+(\.\d+)? ), but the new_data entry still gets converted to a Decimal instance, so the form displays an error message but the data in the box

Re: Creating a new field type

2006-07-24 Thread adurdin
Jacob Kaplan-Moss wrote: > > A good example might be to look at the ``DateField`` definition > (http://code.djangoproject.com/browser/django/trunk/django/db/models/ > fields/__init__.py#L393). > > As far as I remember, the methods you'll want to play with are > ``Field.to_python()``, ``Field.get_d

Re: Creating a new field type

2006-07-21 Thread Jacob Kaplan-Moss
On Jul 21, 2006, at 11:46 AM, adurdin wrote: > I'm trying to create a new database field type, and am not sure what > method of models.Field I need to override to convert the value > returned > from the database to the appropriate Python type and vice-versa -- if > indeed it should be done in mo

Creating a new field type

2006-07-21 Thread adurdin
I'm trying to create a new database field type, and am not sure what method of models.Field I need to override to convert the value returned from the database to the appropriate Python type and vice-versa -- if indeed it should be done in models.Field. For the sake of example, assume I want to st