Re: DateTimeField TypeError: replace() takes no keyword arguments?

2005-08-20 Thread jtm

It's not Django, it's me.

Between the caffeine and lack of sleep and looming deadline, skimming
the Django documentation led me to believe that you attach foreign keys
like so:

a = aClass()
b = add_aClass(a)

where is I should have been saying:

a = aClass(b_id=b.id)

Unless there is another way to add foreign keys?

Thanks,

jtm



DateTimeField TypeError: replace() takes no keyword arguments?

2005-08-20 Thread jtm

This one has me stumped.

I have a mySession class with three DateTimeFields along these lines:

meta.DateTimeField('session_start', 'Session Start Time',
auto_now_add=True)

when I create a new mySession instance and try to .save() it, I get the
following Traceback:

Traceback (most recent call last):

  File "D:\python24\lib\site-packages\django\core\handlers\base.py",
line 64, in get_response
response = callback(request, **param_dict)

  File "D:\python24\lib\site-packages\dcm\apps\survey\views\survey.py",
line 110, in checkLogin
sess.save()

  File "D:\python24\lib\site-packages\django\utils\functional.py", line
3, in _curried
return args[0](*(args[1:]+moreargs), **dict(kwargs.items() +
morekwargs.items()))

  File "D:\python24\lib\site-packages\django\core\meta\__init__.py",
line 739, in method_save
db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.name),
False)) for f in non_pks]

  File "D:\python24\lib\site-packages\django\core\meta\fields.py", line
308, in get_db_prep_save
value = value.replace(microsecond=0)

TypeError: replace() takes no keyword arguments


Anyone have any hints about this? I fiddled a little, like putting an
"if not isinstance(value, datetime.datetime): raise TypeError" kind of
thing above line 308, and it was throwing the exception, but I have no
idea how to progress things from there.

Any tips on the best ways to get debugging output from django when
you're in the browser would be warmly received.

Thanks again,

jtm