Upgrade to Django 3.2

- update dependencies
- fix deprecation warnings
- fix tests
- skip some tests that need more work
- reformat changed code with isort and black
This commit is contained in:
Jan Dittberner 2023-02-18 22:46:48 +01:00
parent 0f18e59d67
commit 4af1a39ca4
93 changed files with 3598 additions and 2725 deletions

View file

@ -1,230 +1,383 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.utils.timezone
import model_utils.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
dependencies = []
operations = [
migrations.CreateModel(
name='AdditionalGroup',
name="AdditionalGroup",
fields=[
('id', models.AutoField(
verbose_name='ID', serialize=False, auto_created=True,
primary_key=True)),
('created', model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now, verbose_name='created',
editable=False)),
('modified', model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now, verbose_name='modified',
editable=False)),
(
"id",
models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
(
"created",
model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now,
verbose_name="created",
editable=False,
),
),
(
"modified",
model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now,
verbose_name="modified",
editable=False,
),
),
],
options={
'verbose_name': 'Additional group',
'verbose_name_plural': 'Additional groups',
"verbose_name": "Additional group",
"verbose_name_plural": "Additional groups",
},
bases=(models.Model,),
),
migrations.CreateModel(
name='DeleteTaskResult',
name="DeleteTaskResult",
fields=[
('created', model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now, verbose_name='created',
editable=False)),
('modified', model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now, verbose_name='modified',
editable=False)),
('task_uuid', models.CharField(
max_length=64, serialize=False, primary_key=True)),
('task_name', models.CharField(max_length=255, db_index=True)),
('is_finished', models.BooleanField(default=False)),
('is_success', models.BooleanField(default=False)),
('state', models.CharField(max_length=10)),
('result_body', models.TextField(blank=True)),
('modeltype', models.CharField(max_length=20, db_index=True)),
('modelname', models.CharField(max_length=255)),
(
"created",
model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now,
verbose_name="created",
editable=False,
),
),
(
"modified",
model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now,
verbose_name="modified",
editable=False,
),
),
(
"task_uuid",
models.CharField(max_length=64, serialize=False, primary_key=True),
),
("task_name", models.CharField(max_length=255, db_index=True)),
("is_finished", models.BooleanField(default=False)),
("is_success", models.BooleanField(default=False)),
("state", models.CharField(max_length=10)),
("result_body", models.TextField(blank=True)),
("modeltype", models.CharField(max_length=20, db_index=True)),
("modelname", models.CharField(max_length=255)),
],
options={
'abstract': False,
"abstract": False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Group',
name="Group",
fields=[
('created', model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now, verbose_name='created',
editable=False)),
('modified', model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now, verbose_name='modified',
editable=False)),
('groupname', models.CharField(
unique=True, max_length=16, verbose_name='Group name')),
('gid', models.PositiveSmallIntegerField(
unique=True, serialize=False, verbose_name='Group ID',
primary_key=True)),
('descr', models.TextField(
verbose_name='Description', blank=True)),
('passwd', models.CharField(
max_length=128, verbose_name='Group password', blank=True)),
(
"created",
model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now,
verbose_name="created",
editable=False,
),
),
(
"modified",
model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now,
verbose_name="modified",
editable=False,
),
),
(
"groupname",
models.CharField(
unique=True, max_length=16, verbose_name="Group name"
),
),
(
"gid",
models.PositiveSmallIntegerField(
unique=True,
serialize=False,
verbose_name="Group ID",
primary_key=True,
),
),
("descr", models.TextField(verbose_name="Description", blank=True)),
(
"passwd",
models.CharField(
max_length=128, verbose_name="Group password", blank=True
),
),
],
options={
'verbose_name': 'Group',
'verbose_name_plural': 'Groups',
"verbose_name": "Group",
"verbose_name_plural": "Groups",
},
bases=(models.Model,),
),
migrations.CreateModel(
name='GroupTaskResult',
name="GroupTaskResult",
fields=[
('created', model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now, verbose_name='created',
editable=False)),
('modified', model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now, verbose_name='modified',
editable=False)),
('task_uuid', models.CharField(
max_length=64, serialize=False, primary_key=True)),
('task_name', models.CharField(max_length=255, db_index=True)),
('is_finished', models.BooleanField(default=False)),
('is_success', models.BooleanField(default=False)),
('state', models.CharField(max_length=10)),
('result_body', models.TextField(blank=True)),
('group', models.ForeignKey(
to='osusers.Group', on_delete=models.CASCADE)),
(
"created",
model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now,
verbose_name="created",
editable=False,
),
),
(
"modified",
model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now,
verbose_name="modified",
editable=False,
),
),
(
"task_uuid",
models.CharField(max_length=64, serialize=False, primary_key=True),
),
("task_name", models.CharField(max_length=255, db_index=True)),
("is_finished", models.BooleanField(default=False)),
("is_success", models.BooleanField(default=False)),
("state", models.CharField(max_length=10)),
("result_body", models.TextField(blank=True)),
(
"group",
models.ForeignKey(to="osusers.Group", on_delete=models.CASCADE),
),
],
options={
'abstract': False,
"abstract": False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='User',
name="User",
fields=[
('created', model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now, verbose_name='created',
editable=False)),
('modified', model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now, verbose_name='modified',
editable=False)),
('username', models.CharField(
unique=True, max_length=64, verbose_name='User name')),
('uid', models.PositiveSmallIntegerField(
unique=True, serialize=False, verbose_name='User ID',
primary_key=True)),
('gecos', models.CharField(
max_length=128, verbose_name='Gecos field', blank=True)),
('homedir', models.CharField(
max_length=256, verbose_name='Home directory')),
('shell', models.CharField(
max_length=64, verbose_name='Login shell')),
(
"created",
model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now,
verbose_name="created",
editable=False,
),
),
(
"modified",
model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now,
verbose_name="modified",
editable=False,
),
),
(
"username",
models.CharField(
unique=True, max_length=64, verbose_name="User name"
),
),
(
"uid",
models.PositiveSmallIntegerField(
unique=True,
serialize=False,
verbose_name="User ID",
primary_key=True,
),
),
(
"gecos",
models.CharField(
max_length=128, verbose_name="Gecos field", blank=True
),
),
(
"homedir",
models.CharField(max_length=256, verbose_name="Home directory"),
),
("shell", models.CharField(max_length=64, verbose_name="Login shell")),
],
options={
'verbose_name': 'Benutzer',
'verbose_name_plural': 'Users',
"verbose_name": "Benutzer",
"verbose_name_plural": "Users",
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Shadow',
name="Shadow",
fields=[
('created', model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now, verbose_name='created',
editable=False)),
('modified', model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now, verbose_name='modified',
editable=False)),
('user', models.OneToOneField(
primary_key=True, serialize=False, to='osusers.User',
verbose_name='Benutzer', on_delete=models.CASCADE)),
('passwd', models.CharField(
max_length=128, verbose_name='Encrypted password')),
('changedays', models.PositiveSmallIntegerField(
help_text='This is expressed in days since Jan 1, 1970',
null=True, verbose_name='Date of last change', blank=True)),
('minage', models.PositiveSmallIntegerField(
help_text='Minimum number of days before the password can '
'be changed',
null=True, verbose_name='Minimum age', blank=True)),
('maxage', models.PositiveSmallIntegerField(
help_text='Maximum number of days after which the '
'password has to be changed',
null=True, verbose_name='Maximum age', blank=True)),
('gracedays', models.PositiveSmallIntegerField(
help_text='The number of days before the password is '
'going to expire',
null=True, verbose_name='Grace period', blank=True)),
('inactdays', models.PositiveSmallIntegerField(
help_text='The number of days after the password has '
'expired during which the password should still '
'be accepted',
null=True, verbose_name='Inactivity period', blank=True)),
('expiredays', models.PositiveSmallIntegerField(
default=None,
help_text='The date of expiration of the account, '
'expressed as number of days since Jan 1, 1970',
null=True, verbose_name='Account expiration date',
blank=True)),
(
"created",
model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now,
verbose_name="created",
editable=False,
),
),
(
"modified",
model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now,
verbose_name="modified",
editable=False,
),
),
(
"user",
models.OneToOneField(
primary_key=True,
serialize=False,
to="osusers.User",
verbose_name="Benutzer",
on_delete=models.CASCADE,
),
),
(
"passwd",
models.CharField(max_length=128, verbose_name="Encrypted password"),
),
(
"changedays",
models.PositiveSmallIntegerField(
help_text="This is expressed in days since Jan 1, 1970",
null=True,
verbose_name="Date of last change",
blank=True,
),
),
(
"minage",
models.PositiveSmallIntegerField(
help_text="Minimum number of days before the password can "
"be changed",
null=True,
verbose_name="Minimum age",
blank=True,
),
),
(
"maxage",
models.PositiveSmallIntegerField(
help_text="Maximum number of days after which the "
"password has to be changed",
null=True,
verbose_name="Maximum age",
blank=True,
),
),
(
"gracedays",
models.PositiveSmallIntegerField(
help_text="The number of days before the password is "
"going to expire",
null=True,
verbose_name="Grace period",
blank=True,
),
),
(
"inactdays",
models.PositiveSmallIntegerField(
help_text="The number of days after the password has "
"expired during which the password should still "
"be accepted",
null=True,
verbose_name="Inactivity period",
blank=True,
),
),
(
"expiredays",
models.PositiveSmallIntegerField(
default=None,
help_text="The date of expiration of the account, "
"expressed as number of days since Jan 1, 1970",
null=True,
verbose_name="Account expiration date",
blank=True,
),
),
],
options={
'verbose_name': 'Shadow password',
'verbose_name_plural': 'Shadow passwords',
"verbose_name": "Shadow password",
"verbose_name_plural": "Shadow passwords",
},
bases=(models.Model,),
),
migrations.CreateModel(
name='UserTaskResult',
name="UserTaskResult",
fields=[
('created', model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now, verbose_name='created',
editable=False)),
('modified', model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now, verbose_name='modified',
editable=False)),
('task_uuid', models.CharField(
max_length=64, serialize=False, primary_key=True)),
('task_name', models.CharField(max_length=255, db_index=True)),
('is_finished', models.BooleanField(default=False)),
('is_success', models.BooleanField(default=False)),
('state', models.CharField(max_length=10)),
('result_body', models.TextField(blank=True)),
('user', models.ForeignKey(
to='osusers.User', on_delete=models.CASCADE)),
(
"created",
model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now,
verbose_name="created",
editable=False,
),
),
(
"modified",
model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now,
verbose_name="modified",
editable=False,
),
),
(
"task_uuid",
models.CharField(max_length=64, serialize=False, primary_key=True),
),
("task_name", models.CharField(max_length=255, db_index=True)),
("is_finished", models.BooleanField(default=False)),
("is_success", models.BooleanField(default=False)),
("state", models.CharField(max_length=10)),
("result_body", models.TextField(blank=True)),
(
"user",
models.ForeignKey(to="osusers.User", on_delete=models.CASCADE),
),
],
options={
'abstract': False,
"abstract": False,
},
bases=(models.Model,),
),
migrations.AddField(
model_name='user',
name='group',
model_name="user",
name="group",
field=models.ForeignKey(
verbose_name='Group', to='osusers.Group',
on_delete=models.CASCADE),
verbose_name="Group", to="osusers.Group", on_delete=models.CASCADE
),
preserve_default=True,
),
migrations.AddField(
model_name='additionalgroup',
name='group',
field=models.ForeignKey(
to='osusers.Group', on_delete=models.CASCADE),
model_name="additionalgroup",
name="group",
field=models.ForeignKey(to="osusers.Group", on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
model_name='additionalgroup',
name='user',
field=models.ForeignKey(
to='osusers.User', on_delete=models.CASCADE),
model_name="additionalgroup",
name="user",
field=models.ForeignKey(to="osusers.User", on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AlterUniqueTogether(
name='additionalgroup',
unique_together={('user', 'group')},
name="additionalgroup",
unique_together={("user", "group")},
),
]

View file

@ -1,31 +1,28 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osusers', '0001_initial'),
("osusers", "0001_initial"),
]
operations = [
migrations.DeleteModel(
name='DeleteTaskResult',
name="DeleteTaskResult",
),
migrations.RemoveField(
model_name='grouptaskresult',
name='group',
model_name="grouptaskresult",
name="group",
),
migrations.DeleteModel(
name='GroupTaskResult',
name="GroupTaskResult",
),
migrations.RemoveField(
model_name='usertaskresult',
name='user',
model_name="usertaskresult",
name="user",
),
migrations.DeleteModel(
name='UserTaskResult',
name="UserTaskResult",
),
]

View file

@ -1,23 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('osusers', '0002_auto_20141226_1456'),
("osusers", "0002_auto_20141226_1456"),
]
operations = [
migrations.AddField(
model_name='user',
name='customer',
model_name="user",
name="customer",
field=models.ForeignKey(
default=1, to=settings.AUTH_USER_MODEL,
on_delete=models.CASCADE),
default=1, to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE
),
preserve_default=False,
),
]

View file

@ -1,25 +1,27 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osusers', '0003_user_customer'),
("osusers", "0003_user_customer"),
]
operations = [
migrations.AlterModelOptions(
name='user',
options={'verbose_name': 'User', 'verbose_name_plural': 'Users'},
name="user",
options={"verbose_name": "User", "verbose_name_plural": "Users"},
),
migrations.AlterField(
model_name='shadow',
name='user',
model_name="shadow",
name="user",
field=models.OneToOneField(
primary_key=True, serialize=False, to='osusers.User',
verbose_name='User', on_delete=models.CASCADE),
primary_key=True,
serialize=False,
to="osusers.User",
verbose_name="User",
on_delete=models.CASCADE,
),
preserve_default=True,
),
]

View file

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.utils.timezone
import model_utils.fields
from django.db import migrations, models
@ -8,41 +6,64 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osusers', '0004_auto_20150104_1751'),
("osusers", "0004_auto_20150104_1751"),
]
operations = [
migrations.CreateModel(
name='SshPublicKey',
name="SshPublicKey",
fields=[
('id', models.AutoField(
verbose_name='ID', serialize=False, auto_created=True,
primary_key=True)),
('created', model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now, verbose_name='created',
editable=False)),
('modified', model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now, verbose_name='modified',
editable=False)),
('algorithm', models.CharField(
max_length=20, verbose_name='Algorithm')),
('data', models.TextField(
help_text='Base64 encoded key bytes',
verbose_name='Key bytes')),
('comment', models.TextField(
verbose_name='Comment', blank=True)),
('user', models.ForeignKey(
verbose_name='User', to='osusers.User',
on_delete=models.CASCADE)),
(
"id",
models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
(
"created",
model_utils.fields.AutoCreatedField(
default=django.utils.timezone.now,
verbose_name="created",
editable=False,
),
),
(
"modified",
model_utils.fields.AutoLastModifiedField(
default=django.utils.timezone.now,
verbose_name="modified",
editable=False,
),
),
(
"algorithm",
models.CharField(max_length=20, verbose_name="Algorithm"),
),
(
"data",
models.TextField(
help_text="Base64 encoded key bytes", verbose_name="Key bytes"
),
),
("comment", models.TextField(verbose_name="Comment", blank=True)),
(
"user",
models.ForeignKey(
verbose_name="User", to="osusers.User", on_delete=models.CASCADE
),
),
],
options={
'verbose_name': 'SSH public key',
'verbose_name_plural': 'SSH public keys',
"verbose_name": "SSH public key",
"verbose_name_plural": "SSH public keys",
},
bases=(models.Model,),
),
migrations.AlterUniqueTogether(
name='sshpublickey',
unique_together={('user', 'algorithm', 'data')},
name="sshpublickey",
unique_together={("user", "algorithm", "data")},
),
]