Skip to content

Commit

Permalink
Update AddressField for Django 2.0
Browse files Browse the repository at this point in the history
Overloaded init needs to set on_delete

virtual_only has been renamed to private_only
django/django@c339a5a

Refs furious-luke#76
  • Loading branch information
klowe0100 committed Dec 24, 2017
1 parent ef1581e commit 60b213d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions address/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,12 @@ class AddressField(models.ForeignKey):

def __init__(self, *args, **kwargs):
kwargs['to'] = 'address.Address'
kwargs['on_delete'] = models.CASCADE
super(AddressField, self).__init__(**kwargs)

def contribute_to_class(self, cls, name, virtual_only=False):
super(ForeignObject, self).contribute_to_class(cls, name, virtual_only=virtual_only)
def contribute_to_class(self, cls, name, private_only=False):
super(ForeignObject, self).contribute_to_class(
cls, name, private_only=private_only)
setattr(cls, self.name, AddressDescriptor(self))

# def deconstruct(self):
Expand Down

0 comments on commit 60b213d

Please sign in to comment.