Re: through/unique_together usage

2010-08-02 Thread Steve Holden
Yes. regards Steve On 8/2/2010 5:55 AM, Dave wrote: > Each patient can have multiple images. Each image can only be of a > single patient. Have I got the model wrong? Should it be a ForeignKey > in ImageRecord to Patient? > > On Jul 29, 6:06 pm, Dennis Kaarsemaker wrote: >> On do, 2010-07-29 a

Re: through/unique_together usage

2010-08-02 Thread Dave
No MySQL. But I found a bit of docs saying that this behaviour is expected: if you use through then that field cannot be automatically added to the admin pages. It suggested using an inline in these cases and that has worked, sort of :-). In fact, I'm beginning to suspect that my model design may

Re: through/unique_together usage

2010-08-02 Thread Dave
Each patient can have multiple images. Each image can only be of a single patient. Have I got the model wrong? Should it be a ForeignKey in ImageRecord to Patient? On Jul 29, 6:06 pm, Dennis Kaarsemaker wrote: > On do, 2010-07-29 at 05:35 -0700, Dave wrote: > > > In my application I want to enfor

Re: through/unique_together usage

2010-07-29 Thread Dennis Kaarsemaker
On do, 2010-07-29 at 05:35 -0700, Dave wrote: > In my application I want to enforce a each-image-can-only-be-assigned- > to-a-single-patient So why do you use a ManyToManyField instead of a ForeignKey? -- Dennis K. They've gone to plaid! -- You received this message because you are subscribe

Re: through/unique_together usage

2010-07-29 Thread Shawn Milochik
Are you using sqlite3? It doesn't support the unique_together constraint. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-u

through/unique_together usage

2010-07-29 Thread Dave
Hi, In my application I want to enforce a each-image-can-only-be-assigned- to-a-single-patient and believed I'd be able to do this by adding a unique_together=("patient", "image") to the PatientImageRecord definition - summary of my models.py: class ImageCatagory(models.Model): ... class Ima