Added proxy ForeignKey and OneToOneField classes which set the now required on_delete parameter on the fields to the legacy value.
- Legacy-Id: 14660
This commit is contained in:
parent
f5cf9a2854
commit
c760792339
|
@ -15,4 +15,14 @@ class VersionInfo(models.Model):
|
|||
used = models.BooleanField(default=True)
|
||||
class Meta:
|
||||
verbose_name_plural = 'VersionInfo'
|
||||
|
||||
class ForeignKey(models.ForeignKey):
|
||||
"A local ForeignKey proxy which provides the on_delete value required under Django 2.0."
|
||||
def __init__(self, to, on_delete=models.CASCADE, **kwargs):
|
||||
return super(ForeignKey, self).__init__(to, on_delete=on_delete, **kwargs)
|
||||
|
||||
class OneToOneField(models.OneToOneField):
|
||||
"A local OneToOneField proxy which provides the on_delete value required under Django 2.0."
|
||||
def __init__(self, to, on_delete=models.CASCADE, **kwargs):
|
||||
return super(OneToOneField, self).__init__(to, on_delete=on_delete, **kwargs)
|
||||
|
||||
|
|
Loading…
Reference in a new issue