Changed version check back to old-style for backwards compatibility.

master
Brandon Taylor 2016-10-12 22:23:38 -04:00
parent 6e6b92d759
commit 3f12b10926
1 changed files with 2 additions and 5 deletions

View File

@ -1,6 +1,6 @@
from django import VERSION
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.db import models from django.db import models
from django.utils import version
from adminsortable.fields import SortableForeignKey from adminsortable.fields import SortableForeignKey
@ -88,10 +88,7 @@ class SortableMixin(models.Model):
'typecast to an integer.' 'typecast to an integer.'
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
major, minor, _, _, _ = version.get_complete_version() needs_default = (self._state.adding if VERSION >= (1, 8) else not self.pk)
needs_default = (self._state.adding
if major == 1 and minor >= 8
else not self.pk)
if needs_default: if needs_default:
try: try:
current_max = self.__class__.objects.aggregate( current_max = self.__class__.objects.aggregate(