diff --git a/python/nav/django/settings.py b/python/nav/django/settings.py index 5e27110c6d..1847ec24ca 100644 --- a/python/nav/django/settings.py +++ b/python/nav/django/settings.py @@ -132,8 +132,6 @@ 'nav.django.legacy.LegacyCleanupMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) -if django.VERSION[:2] == (1, 8): # Django <= 1.8 - MIDDLEWARE_CLASSES = MIDDLEWARE SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer' SESSION_ENGINE = 'django.contrib.sessions.backends.db' diff --git a/python/nav/models/fields.py b/python/nav/models/fields.py index 18b29c29f0..6efc77f7b2 100644 --- a/python/nav/models/fields.py +++ b/python/nav/models/fields.py @@ -73,15 +73,9 @@ class DictAsJsonField(models.TextField): def db_type(self, connection): return 'varchar' - if django.VERSION < (2,): # Django < 2.x - # pylint: disable=unused-argument - def from_db_value(self, value, expression, connection, context): - return self.to_python(value) - - else: - # pylint: disable=unused-argument - def from_db_value(self, value, expression, connection): - return self.to_python(value) + # pylint: disable=unused-argument + def from_db_value(self, value, expression, connection): + return self.to_python(value) def to_python(self, value): if value: @@ -128,15 +122,8 @@ def __init__(self, *args, **kwargs): def db_type(self, connection): return 'point' - if django.VERSION < (2,): # Django < 2.x - - def from_db_value(self, value, expression, connection, context): - return self.to_python(value) - - else: - - def from_db_value(self, value, expression, connection): - return self.to_python(value) + def from_db_value(self, value, expression, connection): + return self.to_python(value) def to_python(self, value): if not value or isinstance(value, tuple): @@ -196,10 +183,7 @@ def contribute_to_class(self, cls, name): self.name = name self.model = cls self.cache_attr = "_%s_cache" % name - if django.VERSION[:2] == (1, 8): # Django <= 1.8 - cls._meta.virtual_fields.append(self) - else: - cls._meta.private_fields.append(self) + cls._meta.private_fields.append(self) if not cls._meta.abstract: signals.pre_init.connect(self.instance_pre_init, sender=cls)