Jaymon / prom

A PostgreSQL or SQLite orm for Python
MIT License
22 stars 4 forks source link

problem updating #19

Closed Jaymon closed 8 years ago

Jaymon commented 8 years ago

First, I created a new object and I just wanted to switch the pk to another value and update the database, and that didn't work, so I had to do something like this:

c._id = c_id
for k in c.fields:
    c.modified_fields.add(k)
c.update()

Second, notice the c.update(), that was because c.save() didn't work, figure out why it didn't work. c_id was definitely a valid primary key.

One thing that could be done is if setting the _id then that will trigger all the fields to be marked as modified. Also, we could add a force() method that would save all the fields regardless of whether they were dirty or not.