Re: Struggling with One to One relationships

2014-09-19 Thread Lachlan Musicman
Ah! OK, it's not just me then. Good. It's a usual inheritance problem? I've never seen it with o2m or m2m relations? I think I'll just change them to o2m and check to make sure there's only one in the save method - seems clearer -easier to read for !me, and less scary. Thanks for your help L. O

Re: Struggling with One to One relationships

2014-09-19 Thread Collin Anderson
Yes, this seems to be the usual problem with inheritance. You need to do something scary like workshop_job.__dict__.update(job.__dict__) so that your workshop_job object will actually have all of the info from the job, like date_opened. -- You received this message because you are subscribed t

Re: Struggling with One to One relationships

2014-09-17 Thread Lachlan Musicman
When using the CBVs, the error actually made me consider that I should be using UpdateView rather than CreateView, but that doesn't work - I don't want to change the underlying Job, I just want to add another, as yet non existent, o2o to it. Cheers L. On 18 September 2014 09:48, Lachlan Musicman

Re: Struggling with One to One relationships

2014-09-17 Thread Lachlan Musicman
I get the same error across CBV and FBV when trying to create the second o2o relationship to the super/concrete model Job [2014-09-17 11:49:26] null value in column "date_opened" violates not-null constraint "date_opened" is a var on the Job model. I don't understand why it's trying to create a

Re: Struggling with One to One relationships

2014-09-17 Thread Collin Anderson
what happens when you try? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django

Struggling with One to One relationships

2014-09-16 Thread Lachlan Musicman
Hi I have a super class Job that will never be instantiated on it's own, although is not Meta. There are two other models, WorkshopJob and EngineeringJob, which have o2o links to a Job. On creation of either WorkshopJob and EngineeringJob, a new Job is made. The problem arises because any parti