Re: How to deal with problem about ForeignKey

2009-04-29 Thread Phil Mocek
On Wed, Apr 29, 2009 at 03:06:37PM +0800, Vincent wrote: > The situation is, i have model A and model B, B has a foreignkey > point to A,. > > now i find that i wanna delete records of A without deleting > records of B which pointing to A. You're trying to do something that a relational database

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Malcolm Tredinnick
On Wed, 2009-04-29 at 01:36 -0700, Margie wrote: [...] > Would love to hear a summary of where this might be going from any > developers! I realize it is a tough problem - not complaining here. > Just trying to get a grip on what do do in my own app and whether > there are any changes coming and

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Margie
I had a post on this recently that you would probably find relevant, see: http://groups.google.com/group/django-users/browse_frm/thread/582f21486c1073eb/8af00e9c0577a5e6?lnk=gst&q=margie#8af00e9c0577a5e6 Or search for "deletion of distant related objects" in this group. I'm still somewhat confu

Re: How to deal with problem about ForeignKey

2009-04-29 Thread James Bennett
On Wed, Apr 29, 2009 at 3:59 AM, Daniel Roseman wrote: > You could try defining the foreign key with null=True. >    a = models.ForeignKey(A, null=True) Not really, since there's no support whatsoever for ON DELETE triggers in the ORM. -- "Bureaucrat Conrad, you are technically correct -- the

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Daniel Roseman
On Apr 29, 8:06 am, Vincent wrote: > No, i did not mean this. > The situation is, i have model A and model B, B has a foreignkey point to > A,. > > now i find that i wanna delete records of A without deleting records of B > which pointing to A. > i think i could reset the B's foreignkey field to

Re: How to deal with problem about ForeignKey

2009-04-29 Thread Vincent
No, i did not mean this. The situation is, i have model A and model B, B has a foreignkey point to A,. now i find that i wanna delete records of A without deleting records of B which pointing to A. i think i could reset the B's foreignkey field to integerfield. But i consider it is not the best a

Re: How to deal with problem about ForeignKey

2009-04-28 Thread Marcelo Ramos
On Wed, Apr 29, 2009 at 2:57 AM, Vincent wrote: > Hi, > I got a problem like this: > class A(models.Model): >     id = models.AutoField(primary_key=True) >     field1 = models.TextField() > class B(models.Model): >     a = models.ForeignKey(A) >     field1 = models.TextField() > then there are so

How to deal with problem about ForeignKey

2009-04-28 Thread Vincent
Hi, I got a problem like this: class A(models.Model): id = models.AutoField(primary_key=True) field1 = models.TextField() class B(models.Model): a = models.ForeignKey(A) field1 = models.TextField() then there are some records of A/B, how can i delete records of A and do not delet