wip/75462-Mise-a-jour-django-upgrade-co-po #22
|
@ -12,3 +12,7 @@ a265c6267e75c831b8294a760f94b9d6cffb92ea
|
|||
8251b8188fb57414214ace63459156b43ddda46d
|
||||
# misc: apply django-upgrade (#69426)
|
||||
0bec12d61de2de7f812f5055de2724942beeedb5
|
||||
# misc: bump black version (#75442)
|
||||
f1104382b60386a5cf8c5203638696ad94cbcdd7
|
||||
# misc: bump djhtml version (#75442)
|
||||
b21196f6a32e6a4bb541ef02e7d5ada85fa49f92
|
||||
|
|
|
@ -2,27 +2,27 @@
|
|||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.1.0
|
||||
rev: v3.3.1
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: ['--keep-percent-format', '--py37-plus']
|
||||
args: ['--keep-percent-format', '--py39-plus']
|
||||
- repo: https://github.com/adamchainz/django-upgrade
|
||||
rev: 1.10.0
|
||||
rev: 1.13.0
|
||||
hooks:
|
||||
- id: django-upgrade
|
||||
args: ['--target-version', '2.2']
|
||||
args: ['--target-version', '3.2']
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.3.0
|
||||
rev: 23.1.0
|
||||
hooks:
|
||||
- id: black
|
||||
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
|
||||
args: ['--target-version', 'py39', '--skip-string-normalization', '--line-length', '110']
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
args: ['--profile', 'black', '--line-length', '110']
|
||||
- repo: https://github.com/rtts/djhtml
|
||||
rev: 'v1.5.2'
|
||||
rev: '3.0.5'
|
||||
hooks:
|
||||
- id: djhtml
|
||||
args: ['--tabwidth', '2']
|
||||
|
|
2
README
2
README
|
@ -93,7 +93,7 @@ djhtml is used to automatically indent html files, using those parameters:
|
|||
|
||||
django-upgrade is used to automatically upgrade Django syntax, using those parameters:
|
||||
|
||||
django-upgrade --target-version 2.2
|
||||
django-upgrade --target-version 3.2
|
||||
|
||||
There is .pre-commit-config.yaml to use pre-commit to automatically run these tools
|
||||
before commits. (execute `pre-commit install` to install the git hook.)
|
||||
|
|
|
@ -18,7 +18,7 @@ Depends: openssl,
|
|||
python3-attr (>=17),
|
||||
python3-chardet,
|
||||
python3-cryptography (>= 1.3.4),
|
||||
python3-django (>= 2:2.2),
|
||||
python3-django (>= 2:3.2),
|
||||
|
||||
python3-django-filters,
|
||||
python3-django-import-export (<< 2.6),
|
||||
python3-django-import-export (>= 1),
|
||||
|
|
|
@ -121,6 +121,7 @@ LOGGING = {
|
|||
|
||||
A2_OPENED_SESSION_COOKIE_SECURE = True
|
||||
|
||||
|
||||
# Old settings method
|
||||
def extract_settings_from_environ():
|
||||
import json
|
||||
|
|
2
setup.py
2
setup.py
|
@ -162,7 +162,7 @@ setup(
|
|||
},
|
||||
include_package_data=True,
|
||||
install_requires=[
|
||||
'django>=2.2,<3.3',
|
||||
'django>=3.2,<3.3',
|
||||
'requests>=2.3',
|
||||
'requests-oauthlib',
|
||||
'django-model-utils>=2.4,<4.3',
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
import django
|
||||
|
||||
default_app_config = 'authentic2.app.Authentic2Config'
|
||||
|
||||
if django.VERSION < (2,):
|
||||
from django.forms import fields
|
||||
|
||||
|
|
|
@ -13,5 +13,3 @@
|
|||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
default_app_config = 'authentic2.a2_rbac.apps.Authentic2RBACConfig'
|
||||
|
|
|
@ -86,11 +86,10 @@ class PermissionAdmin(admin.ModelAdmin):
|
|||
list_display = ('name', 'operation', 'ou', 'target')
|
||||
list_select_related = True
|
||||
|
||||
@admin.display(description=_('name'))
|
||||
def name(self, obj):
|
||||
return str(obj)
|
||||
|
||||
name.short_description = _('name')
|
||||
|
||||
|
||||
admin.site.register(models.Role, RoleAdmin)
|
||||
admin.site.register(models.OrganizationalUnit, OrganizationalUnitAdmin)
|
||||
|
|
|
@ -252,8 +252,8 @@ class RoleParentingManager(models.Manager):
|
|||
|
||||
while True:
|
||||
changed = False
|
||||
for (i, j) in list(indirects):
|
||||
for (k, l) in direct:
|
||||
for i, j in list(indirects):
|
||||
for k, l in direct:
|
||||
if j == k and i != l and (i, l) not in indirects:
|
||||
indirects.add((i, l))
|
||||
changed = True
|
||||
|
|
|
@ -6,7 +6,6 @@ import authentic2.utils.misc
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentic2', '0004_service'),
|
||||
('django_rbac', '__first__'),
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0001_initial'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from authentic2.migrations import CreatePartialIndexes
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0002_role_external_id'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0003_partial_unique_index_on_name_and_slug'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0004_auto_20150523_0028'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0005_auto_20150526_1406'),
|
||||
]
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0006_auto_20150619_1056'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0007_auto_20150708_1337'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from authentic2.migrations import CreatePartialIndexes
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0008_auto_20150810_1953'),
|
||||
]
|
||||
|
|
|
@ -39,7 +39,6 @@ def noop(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0009_partial_unique_index_on_permission'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0010_auto_20160209_1417'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0011_auto_20160209_1511'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0013_auto_20170629_0007'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0014_auto_20170711_1024'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0015_organizationalunit_validate_emails'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0016_auto_20171208_1429'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0017_organizationalunit_user_can_reset_password'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0018_organizationalunit_user_add_password_policy'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from authentic2.migrations import CreatePartialIndexes
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0019_organizationalunit_show_username'),
|
||||
]
|
||||
|
|
|
@ -6,7 +6,6 @@ import authentic2.a2_rbac.utils
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0020_partial_unique_index_on_name'),
|
||||
]
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0021_auto_20200317_1514'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0022_auto_20200402_1101'),
|
||||
]
|
||||
|
|
|
@ -30,7 +30,6 @@ def update_self_administration_perm(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0023_role_can_manage_members'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0024_fix_self_admin_perm'),
|
||||
]
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0028_ou_home_url'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0025_auto_20210622_1132'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0026_organizationalunit_check_required_on_login_attributes'),
|
||||
]
|
||||
|
|
|
@ -6,7 +6,6 @@ import authentic2.validators
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0026_add_roleparenting_soft_delete'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0027_auto_20211213_0949'),
|
||||
]
|
||||
|
|
|
@ -6,7 +6,6 @@ from authentic2.migrations import DropPartialIndexes
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentic2', '0039_add_unique_attribute_constraint'),
|
||||
('contenttypes', '0002_remove_content_type_name'),
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0029_use_unique_constraints'),
|
||||
]
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0030_organizationalunit_min_password_strength'),
|
||||
]
|
||||
|
|
|
@ -32,7 +32,6 @@ def reverse_copy_operations_data(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0031_new_operation_model'),
|
||||
('django_rbac', '0009_auto_20221004_1343'),
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0032_copy_operations_data'),
|
||||
]
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0033_remove_old_operation_fk'),
|
||||
]
|
||||
|
|
|
@ -51,7 +51,6 @@ def reverse_populate_role_fields(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0034_new_role_fields'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('a2_rbac', '0035_populate_role_fields'),
|
||||
]
|
||||
|
|
|
@ -78,7 +78,6 @@ class AbstractBase(models.Model):
|
|||
|
||||
|
||||
class OrganizationalUnit(AbstractBase):
|
||||
|
||||
RESET_LINK_POLICY = 0
|
||||
MANUAL_PASSWORD_POLICY = 1
|
||||
|
||||
|
|
|
@ -36,13 +36,11 @@ from .nonce.models import Nonce
|
|||
from .utils import misc as utils_misc
|
||||
|
||||
|
||||
@admin.action(description=_('Cleanup expired objects'))
|
||||
def cleanup_action(modeladmin, request, queryset):
|
||||
queryset.cleanup()
|
||||
|
||||
|
||||
cleanup_action.short_description = _('Cleanup expired objects')
|
||||
|
||||
|
||||
class CleanupAdminMixin(admin.ModelAdmin):
|
||||
def get_actions(self, request):
|
||||
actions = super().get_actions(request)
|
||||
|
@ -51,13 +49,11 @@ class CleanupAdminMixin(admin.ModelAdmin):
|
|||
return actions
|
||||
|
||||
|
||||
@admin.register(Nonce)
|
||||
class NonceModelAdmin(admin.ModelAdmin):
|
||||
list_display = ("value", "context", "not_on_or_after")
|
||||
|
||||
|
||||
admin.site.register(Nonce, NonceModelAdmin)
|
||||
|
||||
|
||||
class AttributeValueAdmin(admin.ModelAdmin):
|
||||
list_display = ('content_type', 'owner', 'attribute', 'content')
|
||||
|
||||
|
@ -100,25 +96,25 @@ DB_SESSION_ENGINES = (
|
|||
|
||||
if settings.SESSION_ENGINE in DB_SESSION_ENGINES:
|
||||
|
||||
@admin.register(Session)
|
||||
class SessionAdmin(admin.ModelAdmin):
|
||||
@admin.display(description=_('session data'))
|
||||
def _session_data(self, obj):
|
||||
return pprint.pformat(obj.get_decoded()).replace('\n', '<br>\n')
|
||||
|
||||
_session_data.allow_tags = True
|
||||
_session_data.short_description = _('session data')
|
||||
list_display = ['session_key', 'ips', 'user', '_session_data', 'expire_date']
|
||||
fields = ['session_key', 'ips', 'user', '_session_data', 'expire_date']
|
||||
readonly_fields = ['ips', 'user', '_session_data']
|
||||
date_hierarchy = 'expire_date'
|
||||
actions = ['clear_expired']
|
||||
|
||||
@admin.display(description=_('IP adresses'))
|
||||
def ips(self, session):
|
||||
content = session.get_decoded()
|
||||
ips = content.get('ips', set())
|
||||
return ', '.join(ips)
|
||||
|
||||
ips.short_description = _('IP adresses')
|
||||
|
||||
@admin.display(description=_('user'))
|
||||
def user(self, session):
|
||||
from django.contrib import auth
|
||||
from django.contrib.auth import models as auth_models
|
||||
|
@ -137,15 +133,10 @@ if settings.SESSION_ENGINE in DB_SESSION_ENGINES:
|
|||
user = _('deleted user %r') % user_id
|
||||
return user
|
||||
|
||||
user.short_description = _('user')
|
||||
|
||||
@admin.action(description=_('clear expired sessions'))
|
||||
def clear_expired(self, request, queryset):
|
||||
queryset.filter(expire_date__lt=timezone.now()).delete()
|
||||
|
||||
clear_expired.short_description = _('clear expired sessions')
|
||||
|
||||
admin.site.register(Session, SessionAdmin)
|
||||
|
||||
|
||||
class ExternalUserListFilter(admin.SimpleListFilter):
|
||||
title = _('external')
|
||||
|
@ -283,6 +274,7 @@ class UserCreationForm(BaseUserForm):
|
|||
return user
|
||||
|
||||
|
||||
@admin.register(User)
|
||||
class AuthenticUserAdmin(UserAdmin):
|
||||
fieldsets = (
|
||||
(None, {'fields': ('uuid', 'ou', 'password')}),
|
||||
|
@ -371,17 +363,13 @@ class AuthenticUserAdmin(UserAdmin):
|
|||
kwargs['fields'] = fields
|
||||
return super().get_form(request, obj=obj, **kwargs)
|
||||
|
||||
@admin.action(description=_('Mark as inactive'))
|
||||
@transaction.atomic
|
||||
def mark_as_inactive(self, request, queryset):
|
||||
timestamp = timezone.now()
|
||||
for user in queryset:
|
||||
user.mark_as_inactive(timestamp=timestamp)
|
||||
|
||||
mark_as_inactive.short_description = _('Mark as inactive')
|
||||
|
||||
|
||||
admin.site.register(User, AuthenticUserAdmin)
|
||||
|
||||
|
||||
class AttributeForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -421,30 +409,24 @@ class AttributeAdmin(admin.ModelAdmin):
|
|||
admin.site.register(models.Attribute, AttributeAdmin)
|
||||
|
||||
|
||||
@admin.register(DeletedUser)
|
||||
class DeletedUserAdmin(admin.ModelAdmin):
|
||||
list_display = ['deleted', 'old_user_id', 'old_uuid', 'old_email']
|
||||
date_hierarchy = 'deleted'
|
||||
search_fields = ['=old_user_id', '^old_uuid', 'old_email']
|
||||
|
||||
|
||||
admin.site.register(DeletedUser, DeletedUserAdmin)
|
||||
|
||||
|
||||
@admin.register(ProfileType)
|
||||
class ProfileTypeAdmin(admin.ModelAdmin):
|
||||
list_display = ['uuid', 'name', 'slug']
|
||||
readonly_fields = ['uuid']
|
||||
|
||||
|
||||
admin.site.register(ProfileType, ProfileTypeAdmin)
|
||||
|
||||
|
||||
@admin.register(Profile)
|
||||
class ProfileAdmin(admin.ModelAdmin):
|
||||
list_display = ['profile_type', 'user', 'identifier', 'email']
|
||||
|
||||
|
||||
admin.site.register(Profile, ProfileAdmin)
|
||||
|
||||
|
||||
@never_cache
|
||||
def login(request, extra_context=None):
|
||||
return utils_misc.redirect_to_login(request, login_url=utils_misc.get_manager_login_url())
|
||||
|
|
|
@ -242,7 +242,6 @@ class Register(BaseRpcView):
|
|||
token = utils_misc.get_hex_uuid()[:16]
|
||||
final_return_url = utils_misc.make_url(validated_data['return_url'], params={'token': token})
|
||||
if email and not validated_data.get('no_email_validation'):
|
||||
|
||||
registration_template = ['authentic2/activation_email']
|
||||
if validated_data['ou']:
|
||||
registration_template.insert(0, 'authentic2/activation_email_%s' % validated_data['ou'].slug)
|
||||
|
|
|
@ -10,7 +10,6 @@ import authentic2.utils.evaluate
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authenticators', '0001_initial'),
|
||||
]
|
||||
|
|
|
@ -22,7 +22,6 @@ def create_login_password_authenticator(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authenticators', '0002_loginpasswordauthenticator'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authenticators', '0003_auto_20220413_1504'),
|
||||
]
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.RBAC_ROLE_MODEL),
|
||||
('authenticators', '0004_auto_20220726_1708'),
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
<div class="pk-tabs--tab-list" role="tablist" aria-label="{% trans "Configuration tabs" %}">
|
||||
{% for form in forms %}
|
||||
<button role="tab"
|
||||
aria-selected="{{ forloop.first|yesno:"true,false" }}"
|
||||
aria-controls="panel-{{ form.tab_slug }}"
|
||||
id="tab-{{ form.tab_slug }}"
|
||||
tabindex="{{ forloop.first|yesno:"0,-1" }}"
|
||||
{% if form.is_not_default %}class="pk-tabs--button-marker"{% endif %}>{{ form.tab_name }}</button>
|
||||
aria-selected="{{ forloop.first|yesno:"true,false" }}"
|
||||
aria-controls="panel-{{ form.tab_slug }}"
|
||||
id="tab-{{ form.tab_slug }}"
|
||||
tabindex="{{ forloop.first|yesno:"0,-1" }}"
|
||||
{% if form.is_not_default %}class="pk-tabs--button-marker"{% endif %}>{{ form.tab_name }}</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -28,9 +28,9 @@
|
|||
{% if forms|length > 1 %}
|
||||
{% for form in forms %}
|
||||
<div id="panel-{{ form.tab_slug }}"
|
||||
role="tabpanel" tabindex="0" {% if not forloop.first %}hidden{% endif %}
|
||||
data-tab-slug="{{ form.tab_slug }}"
|
||||
aria-labelledby="tab-{{ form.tab_slug }}">
|
||||
role="tabpanel" tabindex="0" {% if not forloop.first %}hidden{% endif %}
|
||||
data-tab-slug="{{ form.tab_slug }}"
|
||||
aria-labelledby="tab-{{ form.tab_slug }}">
|
||||
{{ form|with_template }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -14,5 +14,3 @@
|
|||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
default_app_config = 'authentic2.apps.journal.app.JournalAppConfig'
|
||||
|
|
|
@ -22,6 +22,7 @@ from django.utils.html import format_html
|
|||
from .models import Event, EventType
|
||||
|
||||
|
||||
@admin.register(EventType)
|
||||
class EventTypeAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
'__str__',
|
||||
|
@ -29,9 +30,7 @@ class EventTypeAdmin(admin.ModelAdmin):
|
|||
]
|
||||
|
||||
|
||||
admin.site.register(EventType, EventTypeAdmin)
|
||||
|
||||
|
||||
@admin.register(Event)
|
||||
class EventAdmin(admin.ModelAdmin):
|
||||
date_hierarchy = 'timestamp'
|
||||
list_filter = ['type']
|
||||
|
@ -65,6 +64,3 @@ class EventAdmin(admin.ModelAdmin):
|
|||
|
||||
def raw_json(self, event):
|
||||
return format_html('<pre>{}</pre>', json.dumps(event.data or {}, indent=4))
|
||||
|
||||
|
||||
admin.site.register(Event, EventAdmin)
|
||||
|
|
|
@ -5,16 +5,11 @@ import django.contrib.postgres.fields
|
|||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
from django.db.models import JSONField
|
||||
from django.utils import timezone
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('journal', '0001_initial'),
|
||||
]
|
||||
|
|
|
@ -27,10 +27,10 @@ from django.conf import settings
|
|||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.postgres.fields import ArrayField
|
||||
from django.contrib.postgres.fields.jsonb import KeyTextTransform
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db import models
|
||||
from django.db.models import Count, F, Q, QuerySet, Value
|
||||
from django.db.models import Count, F, JSONField, Q, QuerySet, Value
|
||||
from django.db.models.fields.json import KeyTextTransform
|
||||
from django.db.models.functions import Trunc
|
||||
from django.utils.timezone import now, utc
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
@ -40,11 +40,6 @@ from authentic2.utils.cache import GlobalCache
|
|||
from . import sql
|
||||
from .utils import Statistics
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
User = get_user_model()
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auth', '0002_auto_20150323_1720'),
|
||||
]
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('attribute_aggregator', '0001_initial'),
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('attribute_aggregator', '0002_auto_20150409_1840'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('idp', '0003_auto_20150915_2041'),
|
||||
('attribute_aggregator', '0003_auto_20150526_2239'),
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.utils import timezone
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('contenttypes', '__first__'),
|
||||
]
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auth', '0001_initial'),
|
||||
]
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('auth', '0002_auto_20150323_1720'),
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auth', '0003_auto_20150410_1657'),
|
||||
('authentic2', '__first__'),
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auth', '0004_user'),
|
||||
]
|
||||
|
|
|
@ -18,8 +18,6 @@ from django.contrib.auth import get_user_model
|
|||
|
||||
from authentic2 import app_settings
|
||||
|
||||
default_app_config = 'authentic2.backends.apps.AppConfig'
|
||||
|
||||
|
||||
def get_user_queryset():
|
||||
User = get_user_model()
|
||||
|
|
|
@ -13,5 +13,3 @@
|
|||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
default_app_config = 'authentic2.custom_user.apps.CustomUserConfig'
|
||||
|
|
|
@ -28,7 +28,7 @@ from django.utils.encoding import force_str
|
|||
class Command(BaseCommand):
|
||||
help = "Change a user's password for django.contrib.auth."
|
||||
|
||||
requires_system_checks = False
|
||||
requires_system_checks = []
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('username', nargs='?', type=str)
|
||||
|
|
|
@ -23,7 +23,7 @@ from authentic2.custom_user.models import User
|
|||
class Command(BaseCommand):
|
||||
help = "Fix user attributes"
|
||||
|
||||
requires_system_checks = False
|
||||
requires_system_checks = []
|
||||
|
||||
def handle(self, *args, **options):
|
||||
user_ids = User.objects.values_list('id', flat=True)
|
||||
|
|
|
@ -80,7 +80,6 @@ def copy_old_users_to_custom_user_model(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auth', '__first__'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0002_auto_20150410_1823'),
|
||||
]
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.RBAC_OU_MODEL),
|
||||
('custom_user', '0003_auto_20150504_1410'),
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0004_user_ou'),
|
||||
]
|
||||
|
|
|
@ -11,7 +11,6 @@ def set_last_login(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0005_auto_20150522_1527'),
|
||||
]
|
||||
|
|
|
@ -11,7 +11,6 @@ def set_last_login(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0006_auto_20150527_1212'),
|
||||
]
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0007_auto_20150610_1527'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0008_auto_20150617_1606'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0009_auto_20150810_1953'),
|
||||
]
|
||||
|
|
|
@ -6,7 +6,6 @@ def create_attribute_value_for_names(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('contenttypes', '__first__'),
|
||||
('custom_user', '0010_auto_20160307_1418'),
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.utils.timezone import utc
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0011_manual_attribute_values_for_name_fields'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0012_user_modified'),
|
||||
]
|
||||
|
|
|
@ -11,7 +11,6 @@ def set_email_verified(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0013_user_email_verified'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0014_set_email_verified'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0015_auto_20170707_1653'),
|
||||
]
|
||||
|
|
|
@ -6,7 +6,6 @@ import authentic2.validators
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0016_auto_20180925_1107'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0017_auto_20200305_1645'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0018_user_last_account_deletion_alert'),
|
||||
]
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
# Generated by Django 2.2.12 on 2020-05-05 14:16
|
||||
|
||||
import django
|
||||
from django.db import migrations, models
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0019_add_user_deleted'),
|
||||
]
|
||||
|
|
|
@ -16,7 +16,6 @@ def set_unusable_password(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0020_deleteduser'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0024_index_email_by_trigrams'),
|
||||
]
|
||||
|
|
|
@ -40,7 +40,6 @@ def delete_users(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0025_user_deactivation'),
|
||||
]
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0026_remove_user_deleted'),
|
||||
]
|
||||
|
|
|
@ -6,15 +6,10 @@ import django
|
|||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
if django.VERSION < (3, 1):
|
||||
from django.contrib.postgres.fields.jsonb import JSONField # noqa pylint: disable=ungrouped-imports
|
||||
else:
|
||||
from django.db.models import JSONField
|
||||
from django.db.models import JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('custom_user', '0028_user_email_verified_date'),
|
||||
]
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Attention ici ça va casser la possibilité de tirer django depuis bullseye-backports (qui est ce qu’on fait actuellement) : https://packages.debian.org/bullseye-backports/python3-django
Ah oui on dirait bien, je disais ici entrouvert/chrono#54 (comment) que j'avais fait ça sans comprendre et Benj avait l'air serein :)
J'aurai du dire qu'il fallait vérifier l'historique des versions c'est vrai.