Michael Glassford kirjoitti:
>
>
> Alex Gaynor wrote:
>
>> Can you upload it with a .diff extension so we can get proper code
>> highlighting on trac.
>>
>> Alex
>>
>
> Sorry. Done.
I did a quick look and what I understand now it only supports client
side on_delete actions (cascade, protect (restrict), set null and set
default)?
I assume that None means not specified on_delete (old way). Could that
translation to CASCADE or SET_NULL activity made in field construction
phase? Or is there need to have explicitly define on_delete=None?
Only thing I'm a bit worried is a performance. I have model like
following (legacy model):
class Device(models.Model):
name = models.CharField()
class Connector(models.Model):
device = models.ForeignKey(Device, on_delete=CASCADE)
type = models.CharField()
class Connection(models.Model):
connector_1 = models.ForeignKey(Connector, on_delete=CASCADE)
connector_2 = models.ForeignKey(Connector, on_delete=CASCADE)
direction = models.CharField()
class Route(models.Model):
name = models.CharField()
class RouteConnection(models.Model):
route = models.ForeignKey(Route, on_delete=PROTECT)
connection = models.ForeignKey(Connection, on_delete=PROTECT)
Now I have one device that contains 1000 connectors. Each connection has
at least 1 connection. And one connection has one route attached to it
(using RouteConnection).
I want to delete this partical device.
In worst case does system need to traverse over all 999 connections
before hitting one that says we can't delete device?
--
Jani Tiainen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---