Re: saving data from both a model and a derived model

2017-05-29 Thread James Schneider
On Fri, May 26, 2017 at 6:13 AM, wrote: > > James, > > As always, thank you for looking at this. > > Can you clarify for me? > > I though that setting UNIQUE meant that the database objects, i.e objects > already in the database had to be unique. From your response, my > understanding that unique

Re: saving data from both a model and a derived model

2017-05-26 Thread jjanderson52000
James, I just found what I was looking for. It looks like Model.validate_unique() is the test that I am looking for. Jim On Tuesday, May 23, 2017 at 6:44:01 PM UTC-4, jjander...@gmail.com wrote: > > I have a model class, 'A_base', and a 2nd model class, 'A_derived'. When I > save an object of

Re: saving data from both a model and a derived model

2017-05-26 Thread jjanderson52000
James, I'm thinking about my last question more. If each object of the given type must be unique, there must be a manager in Django which keeps track of uniqueness. I will start searching for how I check for unique objects, but if you have a quick response, that will help. Jim On Tuesday, Ma

Re: saving data from both a model and a derived model

2017-05-26 Thread jjanderson52000
James, As always, thank you for looking at this. Can you clarify for me? I though that setting UNIQUE meant that the database objects, i.e objects already in the database had to be unique. From your response, my understanding that uniqueness applies to any object of the model type in memory.

Re: saving data from both a model and a derived model

2017-05-25 Thread James Schneider
On Wed, May 24, 2017 at 11:03 AM, Jim Anderson wrote: > Hi James, > > I'm attaching the stacktrace as you requested. > > Thanks. It is quite telling: File "/home/jja/testenv3.5/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 337, in execute return Database.Cursor.exe

Re: saving data from both a model and a derived model

2017-05-24 Thread Jim Anderson
Hi James, I'm attaching the stacktrace as you requested. The call to rs_template.save() is made from a django view. rs_template is an instance of a class RSTemplate which is derived from STemplate. STemplate is derived from PriorityItemType. PriorityItemType is derived from ItemType. ItemType is

Re: saving data from both a model and a derived model

2017-05-24 Thread James Schneider
On Tue, May 23, 2017 at 3:44 PM, wrote: > I have a model class, 'A_base', and a 2nd model class, 'A_derived'. When I > save an object of A_derived, I want the data from both my base and derived > class to be saved. > > Example code looks like this: > > class A_base(models.model): > na

saving data from both a model and a derived model

2017-05-23 Thread jjanderson52000
I have a model class, 'A_base', and a 2nd model class, 'A_derived'. When I save an object of A_derived, I want the data from both my base and derived class to be saved. Example code looks like this: class A_base(models.model): name = models.CharField(max_length=50) class A_deri