From 7405182e21d9602eafbe30a55b8874f9c3b7d7ef Mon Sep 17 00:00:00 2001 From: Daniel Rus Morales Date: Wed, 9 Sep 2020 20:47:31 +0200 Subject: [PATCH 1/2] Closes issue #215. Add django 3.1 to tox.ini, run the tests using python 3.8. --- .travis.yml | 3 ++- CHANGELOG.md | 8 +++++-- django_comments_xtd/urls.py | 45 ++++++++++++++++++++----------------- tox.ini | 18 ++++++++------- 4 files changed, 42 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index 36a56fdf..fb244bcd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python python: - - 3.7 + - 3.8 cache: pip: @@ -14,6 +14,7 @@ env: - DJANGO="2.1" - DJANGO="2.2" - DJANGO="3.0" + - DJANGO="3.1" before_install: - sudo apt-get update -qq diff --git a/CHANGELOG.md b/CHANGELOG.md index a217f8aa..d52d8a35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## [] - YYYY-MM-DD + + * Fixes issue #215 about running the tests with Django 3.1 and Python 3.8. + ## [2.7.2] - 2020-09-08 * Fixes issue #208, about the JavaScript plugin not displaying the like and @@ -13,8 +17,8 @@ * Fixes issue #188, about loading a templatetags module not required for the application. * Fixes issue #196. When extending django-comments-xtd's comment model, the - receiver function that reviews whether nested comments have to be publish or - unpublish is not called. + receiver function that reviews whether nested comments have to be publish + or unpublish is not called. ## [2.7.0] - 2020-08-09 diff --git a/django_comments_xtd/urls.py b/django_comments_xtd/urls.py index fb92c6b7..54620cee 100644 --- a/django_comments_xtd/urls.py +++ b/django_comments_xtd/urls.py @@ -1,39 +1,42 @@ -from django.conf.urls import include, url +# from django.conf.urls import include, url +from django.urls import include, re_path from rest_framework.urlpatterns import format_suffix_patterns from django_comments_xtd import api, views urlpatterns = [ - url(r'^sent/$', views.sent, name='comments-xtd-sent'), - url(r'^confirm/(?P[^/]+)/$', views.confirm, + re_path(r'^sent/$', views.sent, name='comments-xtd-sent'), + re_path(r'^confirm/(?P[^/]+)/$', views.confirm, name='comments-xtd-confirm'), - url(r'^mute/(?P[^/]+)/$', views.mute, name='comments-xtd-mute'), - url(r'^reply/(?P[\d]+)/$', views.reply, name='comments-xtd-reply'), + re_path(r'^mute/(?P[^/]+)/$', views.mute, name='comments-xtd-mute'), + re_path(r'^reply/(?P[\d]+)/$', views.reply, name='comments-xtd-reply'), # Remap comments-flag to check allow-flagging is enabled. - url(r'^flag/(\d+)/$', views.flag, name='comments-flag'), + re_path(r'^flag/(\d+)/$', views.flag, name='comments-flag'), # New flags in addition to those provided by django-contrib-comments. - url(r'^like/(\d+)/$', views.like, name='comments-xtd-like'), - url(r'^liked/$', views.like_done, name='comments-xtd-like-done'), - url(r'^dislike/(\d+)/$', views.dislike, name='comments-xtd-dislike'), - url(r'^disliked/$', views.dislike_done, name='comments-xtd-dislike-done'), + re_path(r'^like/(\d+)/$', views.like, name='comments-xtd-like'), + re_path(r'^liked/$', views.like_done, name='comments-xtd-like-done'), + re_path(r'^dislike/(\d+)/$', views.dislike, name='comments-xtd-dislike'), + re_path(r'^disliked/$', views.dislike_done, + name='comments-xtd-dislike-done'), # API handlers. - url(r'^api/comment/$', api.CommentCreate.as_view(), - name='comments-xtd-api-create'), - url(r'^api/preview/$', api.preview_user_avatar, - name='comments-xtd-api-preview'), - url(r'^api/(?P\w+[-]{1}\w+)/(?P[-\w]+)/$', + re_path(r'^api/comment/$', api.CommentCreate.as_view(), + name='comments-xtd-api-create'), + re_path(r'^api/preview/$', api.preview_user_avatar, + name='comments-xtd-api-preview'), + re_path(r'^api/(?P\w+[-]{1}\w+)/(?P[-\w]+)/$', api.CommentList.as_view(), name='comments-xtd-api-list'), - url(r'^api/(?P\w+[-]{1}\w+)/(?P[-\w]+)/count/$', + re_path( + r'^api/(?P\w+[-]{1}\w+)/(?P[-\w]+)/count/$', api.CommentCount.as_view(), name='comments-xtd-api-count'), - url(r'^api/feedback/$', api.ToggleFeedbackFlag.as_view(), - name='comments-xtd-api-feedback'), - url(r'^api/flag/$', api.CreateReportFlag.as_view(), - name='comments-xtd-api-flag'), + re_path(r'^api/feedback/$', api.ToggleFeedbackFlag.as_view(), + name='comments-xtd-api-feedback'), + re_path(r'^api/flag/$', api.CreateReportFlag.as_view(), + name='comments-xtd-api-flag'), - url(r'', include("django_comments.urls")), + re_path(r'', include("django_comments.urls")), ] diff --git a/tox.ini b/tox.ini index 89c8ef50..39bb735a 100644 --- a/tox.ini +++ b/tox.ini @@ -8,11 +8,11 @@ django_find_project = false [tox] skipsdist = True -envlist = py36-django{200,210,220,300} +envlist = py38-django{200,210,220,300,310} [travis] python = - 3.6: py36 + 3.8: py38 [travis:env] DJANGO = @@ -20,6 +20,7 @@ DJANGO = 2.1: django210 2.2: django220 3.0: django300 + 3.1: django310 [testenv] changedir = {toxinidir}/django_comments_xtd commands = py.test -rw --cov-config .coveragerc --cov django_comments_xtd @@ -32,12 +33,13 @@ deps = pytest-cov pytest-django selenium - py36-django200: django>=2.0,<2.1 - py36-django210: django>=2.1,<2.2 - py36-django220: django>=2.2,<2.3 - py36-django300: django>=3.0,<3.1 - py36-django{200,210,220,300}: djangorestframework>=3.9 - py36-django{200,210,220,300}: django-contrib-comments + py38-django200: django>=2.0,<2.1 + py38-django210: django>=2.1,<2.2 + py38-django220: django>=2.2,<2.3 + py38-django300: django>=3.0,<3.1 + py38-django310: django>=3.1,<3.2 + py38-django{200,210,220,300,310}: djangorestframework>=3.9 + py38-django{200,210,220,300,310}: django-contrib-comments setenv = PYTHONPATH = {toxinidir}:{toxinidir} DJANGO_SETTINGS_MODULE=django_comments_xtd.tests.settings From b5cc6589b4d493d1192336c7d341062a4aff249c Mon Sep 17 00:00:00 2001 From: Daniel Rus Morales Date: Wed, 9 Sep 2020 20:52:39 +0200 Subject: [PATCH 2/2] PEP8 compliant --- django_comments_xtd/urls.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django_comments_xtd/urls.py b/django_comments_xtd/urls.py index 54620cee..a632f675 100644 --- a/django_comments_xtd/urls.py +++ b/django_comments_xtd/urls.py @@ -8,7 +8,7 @@ urlpatterns = [ re_path(r'^sent/$', views.sent, name='comments-xtd-sent'), re_path(r'^confirm/(?P[^/]+)/$', views.confirm, - name='comments-xtd-confirm'), + name='comments-xtd-confirm'), re_path(r'^mute/(?P[^/]+)/$', views.mute, name='comments-xtd-mute'), re_path(r'^reply/(?P[\d]+)/$', views.reply, name='comments-xtd-reply'), @@ -18,7 +18,7 @@ re_path(r'^like/(\d+)/$', views.like, name='comments-xtd-like'), re_path(r'^liked/$', views.like_done, name='comments-xtd-like-done'), re_path(r'^dislike/(\d+)/$', views.dislike, name='comments-xtd-dislike'), - re_path(r'^disliked/$', views.dislike_done, + re_path(r'^disliked/$', views.dislike_done, name='comments-xtd-dislike-done'), # API handlers. @@ -27,7 +27,7 @@ re_path(r'^api/preview/$', api.preview_user_avatar, name='comments-xtd-api-preview'), re_path(r'^api/(?P\w+[-]{1}\w+)/(?P[-\w]+)/$', - api.CommentList.as_view(), name='comments-xtd-api-list'), + api.CommentList.as_view(), name='comments-xtd-api-list'), re_path( r'^api/(?P\w+[-]{1}\w+)/(?P[-\w]+)/count/$', api.CommentCount.as_view(), name='comments-xtd-api-count'),