Merge branch 'main' into book-file-links
This commit is contained in:
18
bookwyrm/migrations/0121_user_summary_keys.py
Normal file
18
bookwyrm/migrations/0121_user_summary_keys.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.5 on 2021-12-22 11:06
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bookwyrm", "0120_list_embed_key"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="user",
|
||||
name="summary_keys",
|
||||
field=models.JSONField(null=True),
|
||||
),
|
||||
]
|
19
bookwyrm/migrations/0122_alter_annualgoal_year.py
Normal file
19
bookwyrm/migrations/0122_alter_annualgoal_year.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Generated by Django 3.2.5 on 2022-01-04 18:59
|
||||
|
||||
import bookwyrm.models.user
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bookwyrm", "0121_user_summary_keys"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="annualgoal",
|
||||
name="year",
|
||||
field=models.IntegerField(default=bookwyrm.models.user.get_current_year),
|
||||
),
|
||||
]
|
34
bookwyrm/migrations/0123_alter_user_preferred_language.py
Normal file
34
bookwyrm/migrations/0123_alter_user_preferred_language.py
Normal file
@ -0,0 +1,34 @@
|
||||
# Generated by Django 3.2.5 on 2022-01-04 22:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bookwyrm", "0122_alter_annualgoal_year"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="user",
|
||||
name="preferred_language",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
choices=[
|
||||
("en-us", "English"),
|
||||
("de-de", "Deutsch (German)"),
|
||||
("es-es", "Español (Spanish)"),
|
||||
("gl-es", "Galego (Galician)"),
|
||||
("fr-fr", "Français (French)"),
|
||||
("lt-lt", "Lietuvių (Lithuanian)"),
|
||||
("pt-br", "Português do Brasil (Brazilian Portuguese)"),
|
||||
("pt-pt", "Português Europeu (European Portuguese)"),
|
||||
("zh-hans", "简体中文 (Simplified Chinese)"),
|
||||
("zh-hant", "繁體中文 (Traditional Chinese)"),
|
||||
],
|
||||
max_length=255,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
33
bookwyrm/migrations/0124_auto_20220106_1759.py
Normal file
33
bookwyrm/migrations/0124_auto_20220106_1759.py
Normal file
@ -0,0 +1,33 @@
|
||||
# Generated by Django 3.2.10 on 2022-01-06 17:59
|
||||
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def get_admins(apps, schema_editor):
|
||||
"""add any superusers to the "admin" group"""
|
||||
|
||||
db_alias = schema_editor.connection.alias
|
||||
groups = apps.get_model("auth", "Group")
|
||||
try:
|
||||
group = groups.objects.using(db_alias).get(name="admin")
|
||||
except groups.DoesNotExist:
|
||||
# for tests
|
||||
return
|
||||
|
||||
users = apps.get_model("bookwyrm", "User")
|
||||
admins = users.objects.using(db_alias).filter(is_superuser=True)
|
||||
|
||||
for admin in admins:
|
||||
admin.groups.add(group)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bookwyrm", "0123_alter_user_preferred_language"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(get_admins, reverse_code=migrations.RunPython.noop),
|
||||
]
|
Reference in New Issue
Block a user