From a924bfe40ab1acbd6b5831819dcbc8d502896f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= Date: Thu, 1 Sep 2016 14:17:44 +0200 Subject: django: Replace south with django.db.migrations Update tests accordingly. --- semantic_version/django_fields.py | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'semantic_version') diff --git a/semantic_version/django_fields.py b/semantic_version/django_fields.py index 599929a..478cf7b 100644 --- a/semantic_version/django_fields.py +++ b/semantic_version/django_fields.py @@ -58,6 +58,13 @@ class VersionField(SemVerField): self.coerce = kwargs.pop('coerce', False) super(VersionField, self).__init__(*args, **kwargs) + def deconstruct(self): + """Handle django.db.migrations.""" + name, path, args, kwargs = super(VersionField, self).deconstruct() + kwargs['partial'] = self.partial + kwargs['coerce'] = self.coerce + return name, path, args, kwargs + def to_python(self, value): """Converts any value to a base.Version field.""" if value is None or value == '': @@ -83,27 +90,3 @@ class SpecField(SemVerField): if isinstance(value, base.Spec): return value return base.Spec(value) - - -def add_south_rules(): - from south.modelsinspector import add_introspection_rules - - add_introspection_rules([ - ( - (VersionField,), - [], - { - 'partial': ('partial', {'default': False}), - 'coerce': ('coerce', {'default': False}), - }, - ), - ], ["semantic_version\.django_fields"]) - - -try: # pragma: no cover - import south -except ImportError: # pragma: no cover - south = None - -if south: # pragma: no cover - add_south_rules() -- cgit v1.2.1