Compare commits

..

4 Commits

5 changed files with 60 additions and 58 deletions

View File

@ -1,12 +1,13 @@
from functools import partial from functools import partial
from django.contrib import admin from django.contrib import admin
from django.core.exceptions import PermissionDenied
from django.core.mail import send_mass_mail from django.core.mail import send_mass_mail
from django.shortcuts import render from django.shortcuts import render
from django.utils.translation import ngettext, gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext
from .. import settings from .. import settings
from .decorators import action_with_confirmation from .decorators import action_with_confirmation
from .forms import SendEmailForm from .forms import SendEmailForm
@ -37,7 +38,7 @@ class SendEmail(object):
def write_email(self, request): def write_email(self, request):
if not request.user.is_superuser: if not request.user.is_superuser:
raise PermissionDenied raise PermissionDenied()
initial={ initial={
'email_from': self.default_from, 'email_from': self.default_from,
'to': ' '.join(self.get_email_addresses()) 'to': ' '.join(self.get_email_addresses())

View File

@ -1,16 +1,16 @@
from urllib import parse from urllib import parse
from django import forms from django import forms
from django.urls import re_path as url
from django.contrib import admin, messages from django.contrib import admin, messages
from django.contrib.admin.options import IS_POPUP_VAR from django.contrib.admin.options import IS_POPUP_VAR
from django.contrib.admin.utils import unquote from django.contrib.admin.utils import unquote
from django.contrib.auth import update_session_auth_hash from django.contrib.auth import update_session_auth_hash
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.http import HttpResponseRedirect, Http404, HttpResponse
from django.forms.models import BaseInlineFormSet from django.forms.models import BaseInlineFormSet
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.urls import re_path as url
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils.encoding import force_str from django.utils.encoding import force_str
from django.utils.html import escape from django.utils.html import escape
@ -19,14 +19,12 @@ from django.views.decorators.debug import sensitive_post_parameters
from orchestra.models.utils import has_db_field from orchestra.models.utils import has_db_field
from ..utils.python import random_ascii, pairwise from ..utils.python import pairwise, random_ascii
from .forms import AdminPasswordChangeForm from .forms import AdminPasswordChangeForm
#, AdminRawPasswordChangeForm #, AdminRawPasswordChangeForm
#from django.contrib.auth.forms import AdminPasswordChangeForm #from django.contrib.auth.forms import AdminPasswordChangeForm
from .utils import action_to_view from .utils import action_to_view
sensitive_post_parameters_m = method_decorator(sensitive_post_parameters()) sensitive_post_parameters_m = method_decorator(sensitive_post_parameters())
@ -256,7 +254,7 @@ class ChangePasswordAdminMixin(object):
@sensitive_post_parameters_m @sensitive_post_parameters_m
def change_password(self, request, id, form_url=''): def change_password(self, request, id, form_url=''):
if not self.has_change_permission(request): if not self.has_change_permission(request):
raise PermissionDenied raise PermissionDenied()
# TODO use this insetad of self.get_object(), in other places # TODO use this insetad of self.get_object(), in other places
obj = get_object_or_404(self.get_queryset(request), pk=id) obj = get_object_or_404(self.get_queryset(request), pk=id)
raw = request.GET.get('raw', '0') == '1' raw = request.GET.get('raw', '0') == '1'
@ -334,6 +332,6 @@ class ChangePasswordAdminMixin(object):
def show_hash(self, request, id): def show_hash(self, request, id):
if not request.user.is_superuser: if not request.user.is_superuser:
raise PermissionDenied raise PermissionDenied()
obj = get_object_or_404(self.get_queryset(request), pk=id) obj = get_object_or_404(self.get_queryset(request), pk=id)
return HttpResponse(obj.password) return HttpResponse(obj.password)

View File

@ -143,6 +143,8 @@ DATABASES = {
} }
} }
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
# Password validation # Password validation
# https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#auth-password-validators
@ -233,6 +235,7 @@ FLUENT_DASHBOARD_ICON_THEME = '../orchestra/icons'
# Django-celery # Django-celery
import djcelery import djcelery
djcelery.setup_loader() djcelery.setup_loader()
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler' CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'

View File

@ -1,14 +1,14 @@
import sys import sys
from contextlib import ContextDecorator
from threading import local from threading import local
from django.contrib.admin.models import LogEntry from django.contrib.admin.models import LogEntry
from django.db.models.signals import pre_delete, post_save, m2m_changed from django.db.models.signals import m2m_changed, post_save, pre_delete
from django.dispatch import receiver from django.dispatch import receiver
from django.utils.decorators import ContextDecorator
from orchestra.utils.python import OrderedSet from orchestra.utils.python import OrderedSet
from . import manager, Operation, helpers from . import Operation, helpers, manager
from .middlewares import OperationsMiddleware from .middlewares import OperationsMiddleware
from .models import BackendLog, BackendOperation from .models import BackendLog, BackendOperation

View File

@ -1,23 +1,23 @@
Django==2.2.24 Django==3.2.23
django-fluent-dashboard==1.0.1 django-fluent-dashboard==2.0
django-admin-tools==0.9.1 django-admin-tools==0.9.3
django-extensions==3.1.3 django-extensions==3.2.3
django-celery==3.2.1 django-celery==3.3.1
celery==3.1.23 celery<4.0,>=3.1.15
kombu==3.0.35 kombu==3.0.37
billiard==3.3.0.23 billiard==3.3.0.23
Markdown==3.3.4 Markdown==3.5.1
djangorestframework==3.12.4 djangorestframework==3.14.0
Pygments==2.9.0 Pygments==2.17.2
django-filter==2.4.0 django-filter==23.4
jsonfield==3.1.0 jsonfield==3.1.0
python-dateutil>=2.7.0 python-dateutil==2.8.2
passlib==1.7.4 passlib==1.7.4
django-iban==0.3.0 django-iban==0.3.1
requests requests
phonenumbers==8.12.27 phonenumbers==8.13.26
django-countries django-countries
django-localflavor==3.1 django-localflavor==4.0
amqp amqp
anyjson anyjson
pytz pytz