Skip to content

Commit

Permalink
Django 2.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kudlatyamroth authored and tahajahangir committed Jan 10, 2019
1 parent c6e9975 commit 09b7a56
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bitfield/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,12 @@ def __init__(self, fields):
def contribute_to_class(self, cls, name):
self.name = name
self.model = cls
cls._meta.virtual_fields.append(self)

# virtual_fields was deprecated in Django 1.10 and removed in 2.0
private_fields = getattr(cls._meta, "private_fields", None)
if private_fields is None:
private_fields = cls._meta.virtual_fields
private_fields.append(self)

signals.class_prepared.connect(self.validate_fields, sender=cls)

Expand Down

0 comments on commit 09b7a56

Please sign in to comment.