I'm sure I'm missing something small/stupid here, but it has me
stumped.  I have a legacy database system which I'm writing some django
applets for - up until now it has been purely read-only, but working on
making something which can write as well.  I've created a minimal test
case here which replicates the problem (for me, at least).

I have a model defined as:

class TestOne(models.Model):
    id = models.IntegerField(primary_key=True)
    foo = models.CharField(max_length=80)
    class Meta:
        db_table = 'test_one'

and created a table in the database (Postgres, using psycopg) to match
(obviously w/ the normal DB, the tables are already there):

create table test_one (id int4 primary key, foo varchar(80));

I try running the following code in a view:

testing = TestOne(id=8, foo='blah')
testing.save()

and nothing happens.

Looking at my postgres log, I see the following pattern:

LOG:  statement: SET DATESTYLE TO 'ISO'
LOG:  statement: BEGIN; SET TRANSACTION ISOLATION LEVEL READ COMMITTED
LOG:  statement: SET TIME ZONE 'America/Chicago'
LOG:  statement: SET client_encoding to 'UNICODE'
LOG:  statement: SELECT 1 FROM "test_one" WHERE "id"=8
LOG:  statement: INSERT INTO "test_one" ("id","foo") VALUES (8,'blah')
LOG:  statement: ABORT

No matter what I've tried, I'm always having the .save() trigger the
ABORT, and it is unclear to me why that is.  

-J


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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