update django + django_lcore, fix every broken thing

master
alice 3 years ago
parent b0b6e53137
commit 523d374f5b

@ -3,7 +3,7 @@ import binascii
from collections import OrderedDict
from django.contrib.auth.hashers import BasePasswordHasher
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
class LegacyPasswordHasher(BasePasswordHasher):

@ -3,6 +3,7 @@ from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.views.generic.base import RedirectView
import django_lcore
import django_lcore.urls
from lambdainst import views as account_views

@ -7,12 +7,10 @@ from markdown.extensions.toc import TocExtension
from django.http import HttpResponseNotFound
from django.shortcuts import render
from django.conf import settings
from django.utils.translation import ugettext as _, get_language
from django.utils.translation import gettext as _, get_language
from django import http
from django.utils.http import is_safe_url
from django.utils.translation import (
LANGUAGE_SESSION_KEY, check_for_language,
)
from django.utils.http import url_has_allowed_host_and_scheme
from django.utils.translation import check_for_language
from django.template.loader import TemplateDoesNotExist, get_template, select_template
from django.template import Template
from django.template.response import TemplateResponse
@ -61,17 +59,24 @@ def set_lang(request):
""" django.views.i18n.set_language() with GET """
next = request.GET.get('next', request.GET.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 = request.META.get('HTTP_REFERER')
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 = '/'
response = http.HttpResponseRedirect(next)
lang_code = request.GET.get('lang', None)
if lang_code and check_for_language(lang_code):
response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code,
response.set_cookie(
settings.LANGUAGE_COOKIE_NAME,
lang_code,
max_age=settings.LANGUAGE_COOKIE_AGE,
path=settings.LANGUAGE_COOKIE_PATH,
domain=settings.LANGUAGE_COOKIE_DOMAIN)
domain=settings.LANGUAGE_COOKIE_DOMAIN,
secure=settings.LANGUAGE_COOKIE_SECURE,
httponly=settings.LANGUAGE_COOKIE_HTTPONLY,
samesite=settings.LANGUAGE_COOKIE_SAMESITE,
)
return response

@ -1,7 +1,7 @@
from django import template
from django.utils.html import format_html
from downloads.models import Version, Platform
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
register = template.Library()

@ -5,7 +5,7 @@ from django.contrib import admin
from django.contrib import messages
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.utils.html import format_html
import django_lcore
import lcoreapi
@ -81,7 +81,7 @@ class UserAdmin(UserAdmin):
),
)
readonly_fields = ("last_login", "date_joined", "links")
actions = (django_lcore.core_sync_action,)
actions = (django_lcore.admin.core_sync_action,)
def is_paid(self, object):
return object.vpnuser.is_paid

@ -1,7 +1,7 @@
import base64
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.utils.safestring import mark_safe

@ -2,7 +2,7 @@ import random
from datetime import timedelta
from django.db import models, IntegrityError
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.utils import timezone
from django_lcore.core import (
LcoreUserProfileMethods,

@ -1,6 +1,6 @@
import json
import uuid
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.conf import settings

@ -1,4 +1,4 @@
from django.utils.translation import ugettext, ungettext
from django.utils.translation import gettext, ngettext
from django.template import Library
from django.utils.html import avoid_wrapping
from django.utils import formats
@ -11,7 +11,7 @@ def bwformat(bps):
try:
bps = float(bps)
except (TypeError, ValueError, UnicodeDecodeError):
value = ungettext("%(bw)d bps", "%(bw)d bps", 0) % {"bw": 0}
value = ngettext("%(bw)d bps", "%(bw)d bps", 0) % {"bw": 0}
return avoid_wrapping(value)
filesize_number_format = lambda value: formats.number_format(round(value, 1), -1)
@ -23,16 +23,16 @@ def bwformat(bps):
P = 1 * 10 ** 15
if bps < K:
value = ungettext("%(size)d bps", "%(size)d bps", bps) % {"size": bps}
value = ngettext("%(size)d bps", "%(size)d bps", bps) % {"size": bps}
elif bps < M:
value = ugettext("%s Kbps") % filesize_number_format(bps / K)
value = gettext("%s Kbps") % filesize_number_format(bps / K)
elif bps < G:
value = ugettext("%s Mbps") % filesize_number_format(bps / M)
value = gettext("%s Mbps") % filesize_number_format(bps / M)
elif bps < T:
value = ugettext("%s Gbps") % filesize_number_format(bps / G)
value = gettext("%s Gbps") % filesize_number_format(bps / G)
elif bps < P:
value = ugettext("%s Tbps") % filesize_number_format(bps / T)
value = gettext("%s Tbps") % filesize_number_format(bps / T)
else:
value = ugettext("%s Pbps") % filesize_number_format(bps / P)
value = gettext("%s Pbps") % filesize_number_format(bps / P)
return avoid_wrapping(value)

@ -22,7 +22,7 @@ from django.http import (
)
from django.shortcuts import redirect, render
from django.utils import timezone
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.template.loader import render_to_string
from django_countries import countries
import django_lcore

785
poetry.lock generated

File diff suppressed because it is too large Load Diff

@ -5,28 +5,28 @@ description = ""
authors = ["CCrypto <code@ccrypto.org>"]
[tool.poetry.dependencies]
python = ">=3.7,<4.0"
django = "^3.0"
python = ">=3.8,<4.0"
django = "^4.0.0"
jsonfield = "^3.1"
django_countries = "^7"
markdown = "^3.1"
requests = "^2.21"
pygal = "^2.4"
pytz = "^2021.1"
pygal = "^3.0"
pytz = "^2022.1"
stripe = "^2.24"
django-constance = {version = "^2.7",extras = ["database"]}
lcoreapi = {git = "https://git.packetimpact.net/lvpn/lcoreapi.git", tag = "v1.1.1"}
pygments = "^2.3"
psycopg2-binary = "^2.8"
python-frontmatter = "^1"
django-tinymce4-lite = "^1.7"
django-tinymce4-widget = "^6.3"
django-admin-list-filter-dropdown = "^1.0"
django-lcore = {git = "https://git.packetimpact.net/lvpn/django-lcore.git"}
django-pipayments = {git = "git@git.packetimpact.net:lvpn/django-pipayments.git", branch = "main"}
#django-pipayments = {path = "../lvpn/django-pipayments", develop=true}
celery = "^5"
django-celery-beat = "^2.0.0"
redis = "^3.5.3"
django-celery-beat = {git="https://github.com/celery/django-celery-beat",rev="10123d357567ae31f241f89d98561220887799ae"}
redis = "^4.3"
flower = "^1"
django-extensions = "^3.1.3"

@ -1,7 +1,7 @@
from django.contrib import admin
from django.shortcuts import resolve_url
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.utils import formats
from .models import Ticket, TicketMessage, TicketNotifyAddress

@ -1,6 +1,6 @@
from django import forms
from .models import TicketMessage, CATEGORY_CHOICES
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
class NewTicketForm(forms.Form):

@ -1,6 +1,6 @@
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.urls import reverse
from django.template.loader import get_template
from django.core.mail import send_mail

@ -3,7 +3,7 @@ from django.contrib.auth.decorators import login_required
from django.http.response import HttpResponseNotFound
from django.utils import timezone
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from ccvpn.common import get_client_ip
from .models import Ticket, TicketMessage

Loading…
Cancel
Save