Re: How to convert a Django model item to the underlying python object

2007-09-03 Thread Jeremy Dunck
On 9/3/07, shabda <[EMAIL PROTECTED]> wrote: > > I need to convert a models.datefield to a python type. How can I do > this. In general what is the way to convert the django model data type > to a pure python data type? I'm not sure what you're asking here. If your model is like this: class

Re: How to convert a Django model item to the underlying python object

2007-09-03 Thread Alex Koshelev
Each field class has to_python() method: class MyModel( models.Model ): date = models.DateField() # field = MyModel._meta.get_field( "date" ) date_obj = field.to_python( "2007-09-03" )#date_obj is python Date instance --~--~-~--~~~---~--~~ You received