From 8abf0030e215804eb84e63a9233010abc02e05a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= Date: Mon, 8 Nov 2021 14:18:29 +0100 Subject: Add support for Django 4.0 The gettext_lazy function has a different name between Django 2.x and 4.x; use the right one according to the version. Closes #113, #121 --- semantic_version/django_fields.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'semantic_version') diff --git a/semantic_version/django_fields.py b/semantic_version/django_fields.py index caa7a8c..e5bd7eb 100644 --- a/semantic_version/django_fields.py +++ b/semantic_version/django_fields.py @@ -4,8 +4,14 @@ import warnings +import django from django.db import models -from django.utils.translation import ugettext_lazy as _ + +if django.VERSION >= (3, 0): + # See https://docs.djangoproject.com/en/dev/releases/3.0/#features-deprecated-in-3-0 + from django.utils.translation import gettext_lazy as _ +else: + from django.utils.translation import ugettext_lazy as _ from . import base -- cgit v1.2.1