mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
Drop python2.7 support
Our dependency jsonfield broke compatibility with python2.7 recently, and having no real reasons to support python2.7 we just drop it now.
This commit is contained in:
parent
e35d0f4194
commit
c53b766132
18 changed files with 11 additions and 47 deletions
2
setup.py
2
setup.py
|
|
@ -15,8 +15,6 @@ setup(
|
|||
],
|
||||
zip_safe=False,
|
||||
classifiers=[
|
||||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
|
|
|
|||
|
|
@ -1,3 +1 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
default_app_config = 'auditlog.apps.AuditlogConfig'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db.models import Model, NOT_PROVIDED, DateTimeField
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from six import moves
|
||||
|
||||
from auditlog.models import LogEntry
|
||||
|
||||
|
|
@ -11,7 +10,7 @@ class Command(BaseCommand):
|
|||
answer = None
|
||||
|
||||
while answer not in ['', 'y', 'n']:
|
||||
answer = moves.input("Are you sure? [y/N]: ").lower().strip()
|
||||
answer = input("Are you sure? [y/N]: ").lower().strip()
|
||||
|
||||
if answer == 'y':
|
||||
count = LogEntry.objects.all().count()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import contextlib
|
||||
|
||||
from auditlog.compat import is_authenticated
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations
|
||||
import jsonfield.fields
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
from django.db import migrations
|
||||
import jsonfield.fields
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
import ast
|
||||
|
||||
|
|
@ -11,7 +9,6 @@ from django.db import models, DEFAULT_DB_ALIAS
|
|||
from django.db.models import QuerySet, Q
|
||||
from django.utils import formats, timezone
|
||||
from django.utils.encoding import python_2_unicode_compatible, smart_text
|
||||
from django.utils.six import iteritems, integer_types
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from jsonfield.fields import JSONField
|
||||
|
|
@ -43,7 +40,7 @@ class LogEntryManager(models.Manager):
|
|||
kwargs.setdefault('object_pk', pk)
|
||||
kwargs.setdefault('object_repr', smart_text(instance))
|
||||
|
||||
if isinstance(pk, integer_types):
|
||||
if isinstance(pk, int):
|
||||
kwargs.setdefault('object_id', pk)
|
||||
|
||||
get_additional_data = getattr(instance, 'get_additional_data', None)
|
||||
|
|
@ -78,7 +75,7 @@ class LogEntryManager(models.Manager):
|
|||
content_type = ContentType.objects.get_for_model(instance.__class__)
|
||||
pk = self._get_pk_value(instance)
|
||||
|
||||
if isinstance(pk, integer_types):
|
||||
if isinstance(pk, int):
|
||||
return self.filter(content_type=content_type, object_id=pk)
|
||||
else:
|
||||
return self.filter(content_type=content_type, object_pk=smart_text(pk))
|
||||
|
|
@ -98,7 +95,7 @@ class LogEntryManager(models.Manager):
|
|||
content_type = ContentType.objects.get_for_model(queryset.model)
|
||||
primary_keys = list(queryset.values_list(queryset.model._meta.pk.name, flat=True))
|
||||
|
||||
if isinstance(primary_keys[0], integer_types):
|
||||
if isinstance(primary_keys[0], int):
|
||||
return self.filter(content_type=content_type).filter(Q(object_id__in=primary_keys)).distinct()
|
||||
elif isinstance(queryset.model._meta.pk, models.UUIDField):
|
||||
primary_keys = [smart_text(pk) for pk in primary_keys]
|
||||
|
|
@ -226,7 +223,7 @@ class LogEntry(models.Model):
|
|||
"""
|
||||
substrings = []
|
||||
|
||||
for field, values in iteritems(self.changes_dict):
|
||||
for field, values in self.changes_dict.items():
|
||||
substring = smart_text('{field_name:s}{colon:s}{old:s}{arrow:s}{new:s}').format(
|
||||
field_name=field,
|
||||
colon=colon,
|
||||
|
|
@ -249,7 +246,7 @@ class LogEntry(models.Model):
|
|||
model_fields = auditlog.get_model_fields(model._meta.model)
|
||||
changes_display_dict = {}
|
||||
# grab the changes_dict and iterate through
|
||||
for field_name, values in iteritems(self.changes_dict):
|
||||
for field_name, values in self.changes_dict.items():
|
||||
# try to get the field attribute on the model
|
||||
try:
|
||||
field = model._meta.get_field(field_name)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
|
||||
from auditlog.diff import model_instance_diff
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.db.models.signals import pre_save, post_save, post_delete
|
||||
from django.db.models import Model
|
||||
from django.utils.six import iteritems
|
||||
|
||||
|
||||
class AuditlogModelRegistry(object):
|
||||
|
|
|
|||
7
tox.ini
7
tox.ini
|
|
@ -1,8 +1,8 @@
|
|||
[tox]
|
||||
envlist =
|
||||
{py27,py34,py35,py36}-django-18
|
||||
{py27,py34,py35,py36}-django-110
|
||||
{py27,py34,py35,py36}-django-111
|
||||
{py34,py35,py36}-django-18
|
||||
{py34,py35,py36}-django-110
|
||||
{py34,py35,py36}-django-111
|
||||
{py34,py35,py36}-django-20
|
||||
{py35,py36}-django-21
|
||||
{py35,py36}-django-22
|
||||
|
|
@ -23,4 +23,3 @@ basepython =
|
|||
py36: python3.6
|
||||
py35: python3.5
|
||||
py34: python3.4
|
||||
py27: python2.7
|
||||
|
|
|
|||
Loading…
Reference in a new issue