Updating fields

For more on this nuance, see Explicitly specifying auto-primary-key values above and Forcing an INSERT or UPDATE below.In Django 1.5 and earlier, Django did a update at the same time!So today, I’m going to try to explain how the OTA API works by recreating the steps as a blog post with explanation in a simple script.

It behaves like a normal attribute on the model, but is actually an alias for whichever attribute is the primary key field for the model.

You can read and set this value, just as you would for any other attribute, and it will update the correct field in the model.

Assuming you have quality center installed on your local machine (not a typical setup) you might have the following setup: Now you need to find your test sets that need updated.

I typically use folder structure that goes something like: Project – Iteration – Component – Feature It’s a bit convoluted but here’s the code to get a test Set: string test Folder = "Root\QASite\Sprint5\Dashboard\Recent Updates"; string test Set = "Recent Updates - New Defects Logged"; Test Set Factory ts Factory = (Test Set Factory)td Conn.

This method returns the number of objects deleted and a dictionary with the number of deletions per object type.

For more details, including how to delete objects in bulk, see You can’t share pickles between versions Pickles of models are only valid for the version of Django that was used to generate them.

If you assign auto-primary-key values manually, make sure not to use an already-existing primary-key value! Explicitly specifying auto-primary-key values is mostly useful for bulk-saving objects, when you’re confident you won’t have primary-key collision.

If you create a new object with an explicit primary-key value that already exists in the database, Django will assume you’re changing the existing record rather than creating a new one. If you’re using Postgre SQL, the sequence associated with the primary key might need to be updated; see The one gotcha here is that you should be careful not to specify a primary-key value explicitly when saving new objects, if you cannot guarantee the primary-key value is unused.

I’ll use the same scenario, updating test case results in QC, but if requested, I can also show how to get test steps from a test plan, or read & update defects in QC using the OTA library.

Tags: , ,