Skip to content

Commit 4c5c5d0

Browse files
committed
Removed support for Python 2
1 parent 18ecbd6 commit 4c5c5d0

28 files changed

+20
-70
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ dist: xenial
22
language: python
33
matrix:
44
include:
5-
- python: 2.7
6-
env: TOXENV=py27-django111
75
- python: 3.4
86
env: TOXENV=py34-django111
97
- python: 3.4

HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
History
44
=======
55

6+
X.Y.Z (YYYY-MM-DD)
7+
------------------
8+
9+
* Removed support for Python 2.
10+
611
1.9.2 (2019-12-03)
712
------------------
813

django_comments/abstracts.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import unicode_literals
2-
31
from django.conf import settings
42
from django.contrib.contenttypes.fields import GenericForeignKey
53
from django.contrib.contenttypes.models import ContentType
@@ -8,7 +6,6 @@
86
from django.urls import reverse
97
from django.utils import timezone
108
from django.utils.translation import gettext_lazy as _
11-
from six import python_2_unicode_compatible
129

1310
from .managers import CommentManager
1411

@@ -45,7 +42,6 @@ def get_content_object_url(self):
4542
)
4643

4744

48-
@python_2_unicode_compatible
4945
class CommentAbstractModel(BaseCommentAbstractModel):
5046
"""
5147
A user comment about some object.
@@ -90,7 +86,7 @@ def __str__(self):
9086
def save(self, *args, **kwargs):
9187
if self.submit_date is None:
9288
self.submit_date = timezone.now()
93-
super(CommentAbstractModel, self).save(*args, **kwargs)
89+
super().save(*args, **kwargs)
9490

9591
def _get_userinfo(self):
9692
"""

django_comments/admin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import unicode_literals
2-
31
from django.contrib import admin
42
from django.contrib.auth import get_user_model
53
from django.utils.translation import gettext_lazy as _, ngettext
@@ -8,7 +6,7 @@
86
from django_comments.views.moderation import perform_flag, perform_approve, perform_delete
97

108

11-
class UsernameSearch(object):
9+
class UsernameSearch:
1210
"""The User object may not be auth.User, so we need to provide
1311
a mechanism for issuing the equivalent of a .filter(user__username=...)
1412
search in CommentAdmin.
@@ -43,7 +41,7 @@ class CommentsAdmin(admin.ModelAdmin):
4341
actions = ["flag_comments", "approve_comments", "remove_comments"]
4442

4543
def get_actions(self, request):
46-
actions = super(CommentsAdmin, self).get_actions(request)
44+
actions = super().get_actions(request)
4745
# Only superusers should be able to delete the comments from the DB.
4846
if not request.user.is_superuser and 'delete_selected' in actions:
4947
actions.pop('delete_selected')

django_comments/feeds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class LatestCommentFeed(Feed):
1010

1111
def __call__(self, request, *args, **kwargs):
1212
self.site = get_current_site(request)
13-
return super(LatestCommentFeed, self).__call__(request, *args, **kwargs)
13+
return super().__call__(request, *args, **kwargs)
1414

1515
def title(self):
1616
return _("%(site_name)s comments") % dict(site_name=self.site.name)

django_comments/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, target_object, data=None, initial=None, **kwargs):
3030
if initial is None:
3131
initial = {}
3232
initial.update(self.generate_security_data())
33-
super(CommentSecurityForm, self).__init__(data=data, initial=initial, **kwargs)
33+
super().__init__(data=data, initial=initial, **kwargs)
3434

3535
def security_errors(self):
3636
"""Return just those errors associated with security"""

django_comments/migrations/0001_initial.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import models, migrations
52
from django.conf import settings
63

django_comments/migrations/0002_update_user_email_field_length.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import models, migrations
52

63

django_comments/migrations/0003_add_submit_date_index.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import models, migrations
52

63

django_comments/models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from django.db import models
33
from django.utils import timezone
44
from django.utils.translation import gettext_lazy as _
5-
from six import python_2_unicode_compatible
65

76
from .abstracts import (
87
COMMENT_MAX_LENGTH, BaseCommentAbstractModel, CommentAbstractModel,
@@ -14,7 +13,6 @@ class Meta(CommentAbstractModel.Meta):
1413
db_table = "django_comments"
1514

1615

17-
@python_2_unicode_compatible
1816
class CommentFlag(models.Model):
1917
"""
2018
Records a flag on a comment. This is intentionally flexible; right now, a
@@ -59,4 +57,4 @@ def __str__(self):
5957
def save(self, *args, **kwargs):
6058
if self.flag_date is None:
6159
self.flag_date = timezone.now()
62-
super(CommentFlag, self).save(*args, **kwargs)
60+
super().save(*args, **kwargs)

0 commit comments

Comments
 (0)