#2288: Provide an equivalent for 'ON DELETE' and friends
---------------------------+------------------------------------------------
   Reporter:  ubernostrum  |                Owner:  nobody                
     Status:  new          |            Component:  Core framework        
    Version:               |           Resolution:                        
   Keywords:               |                Stage:  Design decision needed
  Has_patch:  0            |           Needs_docs:  0                     
Needs_tests:  0            |   Needs_better_patch:  0                     
---------------------------+------------------------------------------------
Comment (by anonymous):

 Perhaps a temporal solution was to provide a "blank" method that blanks
 all the relations of one object to the others: For example, if we have:
 
 class Person(model.Models):
     firstname   = models.CharField(max_length=100)
     lastname    = models.CharField(max_length=100)
     car = models.ManyToManyField('Car')
 
 class Car(models.Models):
      name = models.CharField(max_length=100)
      number_plate = models.IntegerField()
 
 
 one_car = Car(name="Porche", number_plate="COOL")
 one_car.save()
 this_is_me = Person(firstname="John", lastname="Doe", car=one_car)
 this_is_me.save()
 
 Now I have not this car (I sell it but the car exists). I just want to
 delete my relation to this car. It could be done by:
 
 this_is_me.Car_set.blank(one_car) # This drops one_car with the lists of
 cars I have
 this_is_me.Car_set.all.blank() # This is equivalent that I have no cars
 (but cars exist)
 
 I suppose that this syntax is not good at all, but the main idea as you
 understand I say you: one method that deletes the relations between
 objects and not the objects itselfs.
 
 Thanks,
 Xan.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2288#comment:10>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to