diff --git a/embed_video/fields.py b/embed_video/fields.py index 5619089..c239a42 100644 --- a/embed_video/fields.py +++ b/embed_video/fields.py @@ -1,6 +1,7 @@ from django.db import models from django import forms from django.utils.translation import ugettext_lazy as _ +from django import VERSION from .backends import detect_backend, UnknownIdException, \ UnknownBackendException @@ -19,14 +20,15 @@ class EmbedVideoField(models.URLField): defaults.update(kwargs) return super(EmbedVideoField, self).formfield(**defaults) - def south_field_triple(self): - from south.modelsinspector import introspector - cls_name = '%s.%s' % ( - self.__class__.__module__, - self.__class__.__name__ - ) - args, kwargs = introspector(self) - return (cls_name, args, kwargs) + if VERSION < (1, 9): + def south_field_triple(self): + from south.modelsinspector import introspector + cls_name = '%s.%s' % ( + self.__class__.__module__, + self.__class__.__name__ + ) + args, kwargs = introspector(self) + return (cls_name, args, kwargs) class EmbedVideoFormField(forms.URLField): diff --git a/embed_video/tests/tests_fields.py b/embed_video/tests/tests_fields.py index 2a1f1af..c0bd689 100644 --- a/embed_video/tests/tests_fields.py +++ b/embed_video/tests/tests_fields.py @@ -2,6 +2,7 @@ from mock import patch from unittest import TestCase from django.forms import ValidationError +from django import VERSION from ..fields import EmbedVideoField, EmbedVideoFormField from ..backends import UnknownBackendException, UnknownIdException, \ @@ -16,12 +17,16 @@ class EmbedVideoFieldTestCase(TestCase): self.assertIsInstance(self.field.formfield(), EmbedVideoFormField) - def test_south(self): - self.assertEqual(self.field.south_field_triple(), - ( - 'embed_video.fields.EmbedVideoField', - [], {'max_length': '200'} - )) + if VERSION < (1, 9): + def test_south(self): + self.assertEqual( + self.field.south_field_triple(), + ( + 'embed_video.fields.EmbedVideoField', + [], + {'max_length': '200'} + ) + ) class EmbedVideoFormFieldTestCase(TestCase):