diff forums/migrations/0001_initial.py @ 1206:02181fa5ac9d modernize tip

Update to Django 1.9.
author Brian Neal <bgneal@gmail.com>
date Wed, 22 Jan 2025 17:58:16 -0600
parents 5ba2508939f7
children
line wrap: on
line diff
--- a/forums/migrations/0001_initial.py	Sat Jan 04 21:34:31 2025 -0600
+++ b/forums/migrations/0001_initial.py	Wed Jan 22 17:58:16 2025 -0600
@@ -19,7 +19,8 @@
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('order', models.IntegerField()),
-                ('embed', models.ForeignKey(to='oembed.Oembed')),
+                ('embed', models.ForeignKey(to='oembed.Oembed',
+                                            on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('order',),
@@ -59,7 +60,9 @@
                 ('position', models.IntegerField(default=0, blank=True)),
                 ('topic_count', models.IntegerField(default=0, blank=True)),
                 ('post_count', models.IntegerField(default=0, blank=True)),
-                ('category', models.ForeignKey(related_name='forums', to='forums.Category')),
+                ('category', models.ForeignKey(related_name='forums',
+                                               to='forums.Category',
+                                               on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('position',),
@@ -71,8 +74,10 @@
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('begin_date', models.DateTimeField()),
                 ('end_date', models.DateTimeField()),
-                ('forum', models.ForeignKey(to='forums.Forum')),
-                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
+                ('forum', models.ForeignKey(to='forums.Forum',
+                                            on_delete=models.CASCADE)),
+                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL,
+                                           on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('-end_date',),
@@ -108,10 +113,16 @@
                 ('post_count', models.IntegerField(default=0, blank=True)),
                 ('update_date', models.DateTimeField(db_index=True)),
                 ('bookmarkers', models.ManyToManyField(related_name='favorite_topics', verbose_name=b'bookmarkers', to=settings.AUTH_USER_MODEL, blank=True)),
-                ('forum', models.ForeignKey(related_name='topics', to='forums.Forum')),
-                ('last_post', models.OneToOneField(related_name='parent_topic', null=True, blank=True, to='forums.Post')),
+                ('forum', models.ForeignKey(related_name='topics',
+                                            to='forums.Forum',
+                                            on_delete=models.CASCADE)),
+                ('last_post', models.OneToOneField(related_name='parent_topic',
+                                                   null=True, blank=True,
+                                                   to='forums.Post',
+                                                   on_delete=models.CASCADE)),
                 ('subscribers', models.ManyToManyField(related_name='subscriptions', verbose_name=b'subscribers', to=settings.AUTH_USER_MODEL, blank=True)),
-                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
+                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL,
+                                           on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('-sticky', '-update_date'),
@@ -122,8 +133,10 @@
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('last_visit', models.DateTimeField(db_index=True)),
-                ('topic', models.ForeignKey(to='forums.Topic')),
-                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
+                ('topic', models.ForeignKey(to='forums.Topic',
+                                            on_delete=models.CASCADE)),
+                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL,
+                                           on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('-last_visit',),
@@ -132,17 +145,22 @@
         migrations.AddField(
             model_name='post',
             name='topic',
-            field=models.ForeignKey(related_name='posts', to='forums.Topic'),
+            field=models.ForeignKey(related_name='posts', to='forums.Topic',
+                                    on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='post',
             name='user',
-            field=models.ForeignKey(related_name='posts', to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(related_name='posts',
+                                    to=settings.AUTH_USER_MODEL,
+                                    on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='forum',
             name='last_post',
-            field=models.OneToOneField(related_name='parent_forum', null=True, blank=True, to='forums.Post'),
+            field=models.OneToOneField(related_name='parent_forum', null=True,
+                                       blank=True, to='forums.Post',
+                                       on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='forum',
@@ -152,17 +170,18 @@
         migrations.AddField(
             model_name='flaggedpost',
             name='post',
-            field=models.ForeignKey(to='forums.Post'),
+            field=models.ForeignKey(to='forums.Post', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='flaggedpost',
             name='user',
-            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(to=settings.AUTH_USER_MODEL,
+                                    on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='attachment',
             name='post',
-            field=models.ForeignKey(to='forums.Post'),
+            field=models.ForeignKey(to='forums.Post', on_delete=models.CASCADE),
         ),
         migrations.AlterUniqueTogether(
             name='topiclastvisit',