Hello,

there is the documentation for creating objects
http://www.djangoproject.com/documentation/db-api/#creating-objects

So I create my test-class and create an object
---------------------------------------------------
class test(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)
    email = models.EmailField()

>>>> a = test(first_name = 'a', last_name = 'b', email = '[EMAIL PROTECTED]')
>>>> a.save()
---------------------------------------------------

This works fine. But I tried to pass a dictionary as paramter

>>>> arr = {'first_name':'c', 'last_name':'d', 'email':'[EMAIL PROTECTED]'}
>>>> a = test(arr)
>>>> a.save()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/django/db/models/base.py", line
269, in save
    self.save_base()
  File "/usr/lib/python2.5/site-packages/django/db/models/base.py", line
305, in save_base
    if manager.filter(pk=pk_val).extra(select={'a':
1}).values('a').order_by():
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 84, in __nonzero__
    iter(self).next()
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 78, in _result_iter
    self._fill_cache()
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 490, in _fill_cache
    self._result_cache.append(self._iter.next())
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 514, in iterator
    for row in self.query.results_iter():
  File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py",
line 200, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py",
line 1466, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python2.5/site-packages/django/db/backends/util.py",
line 18, in execute
    return self.cursor.execute(sql, params)
ProgrammingError: can't adapt


Is this not possible? What's my fault here?


 Bernd


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to