Skip to content

Commit

Permalink
Resolve Django's deprecation warnings (#83)
Browse files Browse the repository at this point in the history
* fix Django deprecation warnings
  • Loading branch information
chinskiy authored Apr 18, 2024
1 parent 6ee03e5 commit a174550
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 16 deletions.
7 changes: 3 additions & 4 deletions example/anonymizer/base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from __future__ import absolute_import

import datetime

from django.contrib.admin.models import LogEntry
from django.contrib.auth.models import Group, Permission, User
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.models import Session
from django.utils import timezone

from dj_anonymizer import fields
from dj_anonymizer.register_models import (
Expand All @@ -18,9 +17,9 @@

class UserAnonym(AnonymBase):
email = fields.string('test_email_{seq}@preply.com',
seq_callback=datetime.datetime.now)
seq_callback=timezone.now)
username = fields.string('test_username_{seq}@preply.com',
seq_callback=datetime.datetime.now)
seq_callback=timezone.now)
first_name = fields.string('first name {seq}')
last_name = fields.string('last name {seq}')
password = fields.password('password')
Expand Down
4 changes: 2 additions & 2 deletions example/anonymizer/polls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import absolute_import

import datetime
from django.utils import timezone

from dj_anonymizer import fields
from dj_anonymizer.register_models import (
Expand All @@ -13,7 +13,7 @@

class QuestionAnonym(AnonymBase):
question_text = fields.string("John Doe {seq}")
pub_date = fields.function(datetime.datetime.now)
pub_date = fields.function(timezone.now)

class Meta:
pass
Expand Down
2 changes: 0 additions & 2 deletions example/project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True

STATIC_URL = '/static/'
4 changes: 2 additions & 2 deletions example/project/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.conf.urls import url
from django.contrib import admin
from django.urls import path


urlpatterns = [
url(r'^admin/', admin.site.urls),
path('admin/', admin.site.urls),
]
3 changes: 0 additions & 3 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher',
'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',
]

ROOT_URLCONF = 'test_app.urls'
Expand Down Expand Up @@ -72,8 +71,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True


Expand Down
3 changes: 0 additions & 3 deletions tests/test_anonym_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ def test_string(field_value, seq_start, seq_step, seq_callback, seq_slugify,
('password', '111', 'md5',
'md5$111$d7fe5ea5ff97cc7c2c79e2df5eb7cf93',
'md5$111$d7fe5ea5ff97cc7c2c79e2df5eb7cf93'),
('password', None, 'unsalted_md5',
'5f4dcc3b5aa765d61d8327deb882cf99',
'5f4dcc3b5aa765d61d8327deb882cf99'),
]
)
def test_password(password, salt, hasher, expected_1, expected_2):
Expand Down

0 comments on commit a174550

Please sign in to comment.