Hi all
I have solved the problem I described below. I just guessed at the solution
after
reading Ticket #3413 (closed: invalid). In that case a class object was being
passed
as a param to the database instead of a user id. And indeed clue was the full
error
message in the traceback ....
/usr/lib/python2.3/site-packages/django/db/backends/sqlite3/base.py in execute
params: [<User: play>, 14]
query : 'UPDATE "lab_data" SET "who"=? WHERE "id"=?' self
<django.db.backends.sqlite3.base.SQLiteCursorWrapper object at 0x40577aac>
I therefore have changed:
self.who = threadlocals.get_current_user()
to:
self.who = str(threadlocals.get_current_user())
and now I get the usernmame updated correctly and no errors.
I am using Django 0.97-pre, SVN 5754
Michael Lake wrote:
> Hi all
>
> I am using ThreadLocals from
> http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser
>
> I am getting this error on submitting the form:
> InterfaceError at /erun/10/1/
> Error binding parameter 5 - probably unsupported type.
>
> This is my model:
>
> class Data(models.Model):
> date_added = models.DateTimeField('Date added', editable=False)
> date_changed = models.DateTimeField('Date changed', editable=False)
> who = models.CharField('Who', maxlength='100',
> editable=False)
>
> def save(self):
> if not self.id:
> self.date_added = datetime.datetime.today()
>
> self.date_changed = datetime.datetime.today()
> self.who = threadlocals.get_current_user()
>
> return super(Data, self).save()
>
> The Django users groups turns up a few posts about threadlocals but I can't
> see
> anything like the problem that I have here.
>
--
Michael Lake
Computational Research Support Unit
Science Faculty, UTS
Ph: 9514 2238
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---