Try deleting the table and then syncdb again...

Att,
Victor Lima

Em 25/12/2009, às 00:02, chen gang <gang.c...@nokia.com> escreveu:

> Hi,
> I am really new to this tool... and need you help about this issue,
> thanks in advance!
>
> I create models.py like this,
>
> ...
> class Sms_detailed(models.Model):
>    group = models.CharField(max_length=15)
>    phone_num = models.CharField(max_length=15)
>    IMEI      = models.CharField(max_length=15)
>    sw_ver    = models.CharField(max_length=20)
>    project   = models.CharField(max_length=10)
>    sw_checksum = models.CharField(max_length=10)
>    recv_date_time = models.DateTimeField()
>    raw_data = models.CharField(max_length=30)  # raw reset data
> ...
>
> Then create the db
> [gac...@pipi autosms]$ python manage.py sql asms
> BEGIN;
> ....
> CREATE TABLE "asms_sms_detailed" (
>    "id" integer NOT NULL PRIMARY KEY,
>    "group" varchar(15) NOT NULL,
>    "phone_num" varchar(15) NOT NULL,
>    "IMEI" varchar(15) NOT NULL,
>    "sw_ver" varchar(20) NOT NULL,
>    "project" varchar(10) NOT NULL,
>    "sw_checksum" varchar(10) NOT NULL,
>    "recv_date_time" datetime NOT NULL,
>    "raw_data" varchar(30) NOT NULL
> )
> ;
> ...
> COMMIT;
>
> but when I am trying to save a object,
> sms_detailed = Sms_detailed(group='test',phone_num =
> '123456'
> ,IMEI=
> '1234'
> ,sw_ver=
> '3.03'
> ,sw_checksum=
> '1234',project='rh-125',recv_date_time=datetime.datetime.now 
> (),raw_data='s1234')
>>>> sms_detailed.save()
> Traceback (most recent call last):
>  File "<console>", line 1, in <module>
>  File "/usr/lib/python2.6/site-packages/django/db/models/base.py",  
> line
> 410, in save
>    self.save_base(force_insert=force_insert,  
> force_update=force_update)
>  File "/usr/lib/python2.6/site-packages/django/db/models/base.py",  
> line
> 495, in save_base
>    result = manager._insert(values, return_id=update_pk)
>  File "/usr/lib/python2.6/site-packages/django/db/models/manager.py",
> line 177, in _insert
>    return insert_query(self.model, values, **kwargs)
>  File "/usr/lib/python2.6/site-packages/django/db/models/query.py",
> line 1087, in insert_query
>    return query.execute_sql(return_id)
>  File
> "/usr/lib/python2.6/site-packages/django/db/models/sql/subqueries.py",
> line 320, in execute_sql
>    cursor = super(InsertQuery, self).execute_sql(None)
>  File "/usr/lib/python2.6/site-packages/django/db/models/sql/ 
> query.py",
> line 2369, in execute_sql
>    cursor.execute(sql, params)
>  File "/usr/lib/python2.6/site-packages/django/db/backends/util.py",
> line 19, in execute
>    return self.cursor.execute(sql, params)
>  File
> "/usr/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py",
> line 193, in execute
>    return Database.Cursor.execute(self, query, params)
> OperationalError: table asms_sms_detailed has no column named  
> phone_num
>
>
> Br, Chen Gang
>
> --
>
> You received this message because you are subscribed to the Google  
> Groups "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com 
> .
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en 
> .
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to