summaryrefslogtreecommitdiff
path: root/semantic_version
diff options
context:
space:
mode:
Diffstat (limited to 'semantic_version')
-rw-r--r--semantic_version/django_fields.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/semantic_version/django_fields.py b/semantic_version/django_fields.py
index 478cf7b..39a6c4b 100644
--- a/semantic_version/django_fields.py
+++ b/semantic_version/django_fields.py
@@ -4,7 +4,6 @@
from __future__ import unicode_literals
-import django
from django.db import models
from django.utils.translation import ugettext_lazy as _
@@ -17,13 +16,6 @@ class SemVerField(models.CharField):
kwargs.setdefault('max_length', 200)
super(SemVerField, self).__init__(*args, **kwargs)
- if django.VERSION[:2] < (1, 8):
- def contribute_to_class(self, cls, name, **kwargs):
- """Emulate SubFieldBase for Django < 1.8"""
- super(SemVerField, self).contribute_to_class(cls, name, **kwargs)
- from django.db.models.fields import subclassing
- setattr(cls, self.name, subclassing.Creator(self))
-
def from_db_value(self, value, expression, connection, context):
"""Convert from the database format.
@@ -40,7 +32,7 @@ class SemVerField(models.CharField):
return value
def value_to_string(self, obj):
- value = self.to_python(self._get_val_from_obj(obj))
+ value = self.to_python(self.value_from_object(obj))
return str(value)
def run_validators(self, value):