1. Matthew Schinckel
  2. django-timedelta-field
Issue #1 resolved

get_db_prep value connection??

Yoav Aner
created an issue

Not sure why you are passing a connection to this function, it's not even used, and seems to break things - or maybe I did something wrong??

{{{

!python

def get_db_prep_value(self, value, connection, prepared=None): return self.get_prep_value(value) }}}

I'm getting this error on Django:

...

{{{

!python

File "/usr/lib/python2.5/site-packages/Django-1.1.1-py2.5.egg/django/db/models/base.py", line 410, in save self.save_base(force_insert=force_insert, force_update=force_update) File "/usr/lib/python2.5/site-packages/Django-1.1.1-py2.5.egg/django/db/models/base.py", line 485, in save_base values = [(f, f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, True))) for f in meta.local_fields] File "/usr/lib/python2.5/site-packages/Django-1.1.1-py2.5.egg/django/db/models/fields/init.py", line 192, in get_db_prep_save return self.get_db_prep_value(value) TypeError: get_db_prep_value() takes at least 3 arguments (2 given)

}}}

Comments (4)

  1. Matthew Schinckel repo owner

    For versions of django from 1.2, multiple db connections may be available.

    For versions of django from 1.3, the console gets littered with log messages about deprecated syntax without a connection argument.

    It should be optional, though, to support older django versions.

  2. Yoav Aner reporter

    Wow, that was quick. Thanks. I changed it manually to connection=None and it seemed to work on 1.1.1 (only a very shallow test though).

  3. Log in to comment