From 810ef0afcb29daebe1bd20014c7d14fd52b42449 Mon Sep 17 00:00:00 2001 From: Iman Karimi Date: Mon, 31 Jul 2023 11:25:35 +0330 Subject: [PATCH] fix django v4 problem --- log_reader/models.py | 7 ++++++- log_reader/utils.py | 9 +++++++-- setup.py | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/log_reader/models.py b/log_reader/models.py index 3106eae..ecaad73 100644 --- a/log_reader/models.py +++ b/log_reader/models.py @@ -1,4 +1,9 @@ -from django.utils.translation import ugettext_lazy as _ +import django + +if django.get_version() >= '4': + from django.utils.translation import gettext_lazy as _ +else: + from django.utils.translation import ugettext_lazy as _ class FileLogReader(object): diff --git a/log_reader/utils.py b/log_reader/utils.py index 7b4213d..8af2398 100644 --- a/log_reader/utils.py +++ b/log_reader/utils.py @@ -1,11 +1,16 @@ from __future__ import unicode_literals +import django import os # import re import subprocess -from subprocess import PIPE from fnmatch import fnmatch -from django.utils.translation import ugettext_lazy as _ +from subprocess import PIPE + +if django.get_version() >= '4': + from django.utils.translation import gettext_lazy as _ +else: + from django.utils.translation import ugettext_lazy as _ from log_reader import settings diff --git a/setup.py b/setup.py index 8a6e59d..c9dfb15 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( name='django-log-reader', - version='1.1.5', + version='1.1.6', zip_safe=False, packages=find_packages(), include_package_data=True,