summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2022-02-13 16:48:54 -0500
committerluxagraf <sng@luxagraf.net>2022-02-13 16:48:54 -0500
commit26a2d4a684db273ff707428e36911741a37532f2 (patch)
tree4f9c3665199516378aedd409aa896e7eb909fde4 /app
parent26c7400f5651d36b84adb3971c09dcc0b275b004 (diff)
main: updated to django 4.0
Diffstat (limited to 'app')
-rw-r--r--app/lib/django_comments/abstracts.py2
-rw-r--r--app/lib/django_comments/admin.py2
-rw-r--r--app/lib/django_comments/managers.py4
-rw-r--r--app/lib/django_comments/models.py2
-rw-r--r--app/lib/django_comments/moderation.py2
-rw-r--r--app/lib/django_comments/signals.py7
-rw-r--r--app/lib/django_comments/templatetags/comments.py4
-rw-r--r--app/lib/django_comments/urls.py20
-rw-r--r--app/lib/django_comments/views/utils.py4
-rw-r--r--app/lib/templatetags/templatetags/number_to_word.py4
-rw-r--r--app/links/admin.py3
-rw-r--r--app/lttr/models.py2
-rw-r--r--app/lttr/validators.py1
-rw-r--r--app/media/admin.py2
-rw-r--r--app/media/models.py1
-rw-r--r--app/resume/models.py4
-rw-r--r--app/taxonomy/models.py2
-rw-r--r--app/utils/widgets.py2
18 files changed, 32 insertions, 36 deletions
diff --git a/app/lib/django_comments/abstracts.py b/app/lib/django_comments/abstracts.py
index e74ea02..5428f1a 100644
--- a/app/lib/django_comments/abstracts.py
+++ b/app/lib/django_comments/abstracts.py
@@ -9,7 +9,7 @@ from django.utils.html import mark_safe
from django.db import models
from django.utils import timezone
from six import python_2_unicode_compatible
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
try:
from django.urls import reverse
except ImportError:
diff --git a/app/lib/django_comments/admin.py b/app/lib/django_comments/admin.py
index 8451c70..6a1f5f8 100644
--- a/app/lib/django_comments/admin.py
+++ b/app/lib/django_comments/admin.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.auth import get_user_model
-from django.utils.translation import ugettext_lazy as _, ungettext
+from django.utils.translation import gettext_lazy as _, ngettext
from django_comments import get_model
from django_comments.views.moderation import perform_flag, perform_approve, perform_delete
diff --git a/app/lib/django_comments/managers.py b/app/lib/django_comments/managers.py
index 9e1fc77..33d9e2a 100644
--- a/app/lib/django_comments/managers.py
+++ b/app/lib/django_comments/managers.py
@@ -1,6 +1,6 @@
from django.db import models
from django.contrib.contenttypes.models import ContentType
-from django.utils.encoding import force_text
+from django.utils.encoding import force_str
class CommentManager(models.Manager):
@@ -18,5 +18,5 @@ class CommentManager(models.Manager):
ct = ContentType.objects.get_for_model(model)
qs = self.get_queryset().filter(content_type=ct)
if isinstance(model, models.Model):
- qs = qs.filter(object_pk=force_text(model._get_pk_val()))
+ qs = qs.filter(object_pk=force_str(model._get_pk_val()))
return qs
diff --git a/app/lib/django_comments/models.py b/app/lib/django_comments/models.py
index 204cf2e..6eac46b 100644
--- a/app/lib/django_comments/models.py
+++ b/app/lib/django_comments/models.py
@@ -2,7 +2,7 @@ from six import python_2_unicode_compatible
from django.conf import settings
from django.db import models
from django.utils import timezone
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from .abstracts import (
COMMENT_MAX_LENGTH, BaseCommentAbstractModel, CommentAbstractModel,
diff --git a/app/lib/django_comments/moderation.py b/app/lib/django_comments/moderation.py
index 3e5c412..39ac356 100644
--- a/app/lib/django_comments/moderation.py
+++ b/app/lib/django_comments/moderation.py
@@ -62,7 +62,7 @@ from django.core.mail import send_mail
from django.db.models.base import ModelBase
from django.template import loader
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
import django_comments
from django_comments import signals
diff --git a/app/lib/django_comments/signals.py b/app/lib/django_comments/signals.py
index 079afaf..3aac192 100644
--- a/app/lib/django_comments/signals.py
+++ b/app/lib/django_comments/signals.py
@@ -9,13 +9,14 @@ from django.dispatch import Signal
# discarded and a 400 response. This signal is sent at more or less
# the same time (just before, actually) as the Comment object's pre-save signal,
# except that the HTTP request is sent along with this signal.
-comment_will_be_posted = Signal(providing_args=["comment", "request"])
+
+comment_will_be_posted = Signal() # providing_args=["comment", "request"]
# Sent just after a comment was posted. See above for how this differs
# from the Comment object's post-save signal.
-comment_was_posted = Signal(providing_args=["comment", "request"])
+comment_was_posted = Signal() # providing_args=["comment", "request"]
# Sent after a comment was "flagged" in some way. Check the flag to see if this
# was a user requesting removal of a comment, a moderator approving/removing a
# comment, or some other custom user flag.
-comment_was_flagged = Signal(providing_args=["comment", "flag", "created", "request"])
+comment_was_flagged = Signal() # providing_args=["comment", "flag", "created", "request"]
diff --git a/app/lib/django_comments/templatetags/comments.py b/app/lib/django_comments/templatetags/comments.py
index 9b2d1a4..440a8f6 100644
--- a/app/lib/django_comments/templatetags/comments.py
+++ b/app/lib/django_comments/templatetags/comments.py
@@ -3,7 +3,7 @@ from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.shortcuts import get_current_site
-from django.utils.encoding import smart_text
+from django.utils.encoding import smart_str
import django_comments
@@ -85,7 +85,7 @@ class BaseCommentNode(template.Node):
qs = self.comment_model.objects.filter(
content_type=ctype,
- object_pk=smart_text(object_pk),
+ object_pk=smart_str(object_pk),
site__pk=site_id,
)
diff --git a/app/lib/django_comments/urls.py b/app/lib/django_comments/urls.py
index 45599dc..47d5b48 100644
--- a/app/lib/django_comments/urls.py
+++ b/app/lib/django_comments/urls.py
@@ -1,4 +1,4 @@
-from django.conf.urls import url
+from django.urls import path, re_path
from django.contrib.contenttypes.views import shortcut
from .views.comments import post_comment, comment_done
@@ -8,14 +8,14 @@ from .views.moderation import (
urlpatterns = [
- url(r'^post/$', post_comment, name='comments-post-comment'),
- url(r'^posted/$', comment_done, name='comments-comment-done'),
- url(r'^flag/(\d+)/$', flag, name='comments-flag'),
- url(r'^flagged/$', flag_done, name='comments-flag-done'),
- url(r'^delete/(\d+)/$', delete, name='comments-delete'),
- url(r'^deleted/$', delete_done, name='comments-delete-done'),
- url(r'^approve/(\d+)/$', approve, name='comments-approve'),
- url(r'^approved/$', approve_done, name='comments-approve-done'),
+ re_path(r'^post/$', post_comment, name='comments-post-comment'),
+ re_path(r'^posted/$', comment_done, name='comments-comment-done'),
+ re_path(r'^flag/(\d+)/$', flag, name='comments-flag'),
+ re_path(r'^flagged/$', flag_done, name='comments-flag-done'),
+ re_path(r'^delete/(\d+)/$', delete, name='comments-delete'),
+ re_path(r'^deleted/$', delete_done, name='comments-delete-done'),
+ re_path(r'^approve/(\d+)/$', approve, name='comments-approve'),
+ re_path(r'^approved/$', approve_done, name='comments-approve-done'),
- url(r'^cr/(\d+)/(.+)/$', shortcut, name='comments-url-redirect'),
+ re_path(r'^cr/(\d+)/(.+)/$', shortcut, name='comments-url-redirect'),
]
diff --git a/app/lib/django_comments/views/utils.py b/app/lib/django_comments/views/utils.py
index a5f5c11..793fc43 100644
--- a/app/lib/django_comments/views/utils.py
+++ b/app/lib/django_comments/views/utils.py
@@ -12,7 +12,7 @@ except ImportError: # Python 2
from django.http import HttpResponseRedirect
from django.shortcuts import render, resolve_url
from django.core.exceptions import ObjectDoesNotExist
-from django.utils.http import is_safe_url
+from django.utils.http import url_has_allowed_host_and_scheme
import django_comments
@@ -28,7 +28,7 @@ def next_redirect(request, fallback, **get_kwargs):
Returns an ``HttpResponseRedirect``.
"""
next = request.POST.get('next')
- if not is_safe_url(url=next, allowed_hosts={request.get_host()}):
+ if not url_has_allowed_host_and_scheme(url=next, allowed_hosts={request.get_host()}):
next = resolve_url(fallback)
if get_kwargs:
diff --git a/app/lib/templatetags/templatetags/number_to_word.py b/app/lib/templatetags/templatetags/number_to_word.py
index c153932..5aa4eaf 100644
--- a/app/lib/templatetags/templatetags/number_to_word.py
+++ b/app/lib/templatetags/templatetags/number_to_word.py
@@ -1,4 +1,4 @@
-from django.utils.translation import ungettext, ugettext as _
+from django.utils.translation import gettext as _
import re
from django import template
from django.utils.safestring import mark_safe
@@ -26,4 +26,4 @@ def number_to_word(value):
else:
word = PRIME_NUM[int(value[:1])-1]
return word
- \ No newline at end of file
+
diff --git a/app/links/admin.py b/app/links/admin.py
index f967dde..6e0504e 100644
--- a/app/links/admin.py
+++ b/app/links/admin.py
@@ -1,6 +1,5 @@
from django.contrib import admin
-from django.conf.urls import url
-from django.utils.translation import ungettext, ugettext_lazy as _
+from django.utils.translation import ngettext, gettext_lazy as _
from django.shortcuts import render
from django.contrib.admin import helpers
from django.http import HttpResponseRedirect
diff --git a/app/lttr/models.py b/app/lttr/models.py
index 1efeb79..a1a0c70 100644
--- a/app/lttr/models.py
+++ b/app/lttr/models.py
@@ -5,7 +5,7 @@ from django.contrib.gis.db import models
from django.db.models.signals import post_save
from django.contrib.sites.models import Site
from django.template.loader import select_template
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from django.utils import timezone
from django.utils.text import slugify
from django.urls import reverse
diff --git a/app/lttr/validators.py b/app/lttr/validators.py
index a6355bf..581043c 100644
--- a/app/lttr/validators.py
+++ b/app/lttr/validators.py
@@ -1,6 +1,5 @@
from django.contrib.auth import get_user_model
from django.forms.utils import ValidationError
-from django.utils.translation import ugettext_lazy as _
def validate_email_nouser(email):
diff --git a/app/media/admin.py b/app/media/admin.py
index 305ebd7..0706f7b 100644
--- a/app/media/admin.py
+++ b/app/media/admin.py
@@ -1,8 +1,6 @@
from django.contrib import admin
from django import forms
from django.contrib.gis.admin import OSMGeoAdmin
-from django.conf.urls import url
-from django.utils.translation import ungettext, ugettext_lazy as _
from .models import LuxImage, LuxGallery, LuxImageSize, LuxVideo
from django.shortcuts import render
from django.contrib.admin import helpers
diff --git a/app/media/models.py b/app/media/models.py
index 48fe9c9..d9becf4 100644
--- a/app/media/models.py
+++ b/app/media/models.py
@@ -10,7 +10,6 @@ from django.contrib.sitemaps import Sitemap
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.db.models.signals import m2m_changed
-from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.urls import reverse
from django.apps import apps
diff --git a/app/resume/models.py b/app/resume/models.py
index 2161e88..bac3115 100644
--- a/app/resume/models.py
+++ b/app/resume/models.py
@@ -1,5 +1,5 @@
from django.db import models
-from django.utils.encoding import force_text
+from django.utils.encoding import force_str
from django.urls import reverse
from django.template.defaultfilters import slugify
@@ -46,7 +46,7 @@ class PubItem(models.Model):
return reverse("resume:detail", kwargs={"publisher": self.publisher.slug, "slug": self.slug})
def admin_link(self):
- return force_text('<a href="%s">Visit Site</a>' % (self.url))
+ return force_str('<a href="%s">Visit Site</a>' % (self.url))
admin_link.allow_tags = True
admin_link.short_description = 'Live Article'
diff --git a/app/taxonomy/models.py b/app/taxonomy/models.py
index 6cc1769..736fe15 100644
--- a/app/taxonomy/models.py
+++ b/app/taxonomy/models.py
@@ -1,6 +1,6 @@
from django.contrib.gis.db import models
from django.urls import reverse
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from django.utils.functional import cached_property
from utils.util import markdown_to_html
diff --git a/app/utils/widgets.py b/app/utils/widgets.py
index f4a7a4a..87b39ec 100644
--- a/app/utils/widgets.py
+++ b/app/utils/widgets.py
@@ -4,7 +4,7 @@ from django.contrib import admin
from django.contrib.admin.widgets import AdminFileWidget
from django.contrib.gis.admin import OSMGeoAdmin
from django.utils.safestring import mark_safe
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from django.template.loader import render_to_string
from django.template import Context
from django.forms.widgets import SelectMultiple