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 answer, because there are a lot of similar
problems, and some of which should be delete, the others should not be
delete.

is there any suggestion.

2009/4/29 Marcelo Ramos <marce...@gmail.com>

>
> On Wed, Apr 29, 2009 at 2:57 AM, Vincent <pho...@gmail.com> 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 some records of A/B,
> > how can i delete records of A and do not delete records of B which have
> > foreignkey on A
>
> Did you mean how to delete records of A for which there are no records
> in B pointing to them through the foreign key "a", right?
>
> --
> Marcelo Ramos
> Django/Python developer
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to