12795 users.User migration

This commit is contained in:
Arthur 2024-01-31 15:52:45 -08:00
parent bf518d44e1
commit 7897203723

View File

@ -0,0 +1,31 @@
# Generated by Django 5.0.1 on 2024-01-31 23:18
from django.db import migrations
def update_content_types(apps, schema_editor):
ContentType = apps.get_model('contenttypes', 'ContentType')
# Delete the new ContentTypes effected by the new models in the users app
ContentType.objects.filter(app_label='users', model='user').delete()
# Update the app labels of the original ContentTypes for auth.User to ensure
# that any foreign key references are preserved
ContentType.objects.filter(app_label='auth', model='user').update(app_label='users')
class Migration(migrations.Migration):
dependencies = [
('users', '0002_squashed_0004'),
]
operations = [
migrations.AlterModelTable(
name='user',
table=None,
),
migrations.RunPython(
code=update_content_types,
reverse_code=migrations.RunPython.noop
),
]