annotate 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
rev   line source
bgneal@1028 1 # -*- coding: utf-8 -*-
bgneal@1028 2 from __future__ import unicode_literals
bgneal@1028 3
bgneal@1028 4 from django.db import migrations, models
bgneal@1028 5 from django.conf import settings
bgneal@1028 6
bgneal@1028 7
bgneal@1028 8 class Migration(migrations.Migration):
bgneal@1028 9
bgneal@1028 10 dependencies = [
bgneal@1028 11 ('oembed', '__first__'),
bgneal@1028 12 migrations.swappable_dependency(settings.AUTH_USER_MODEL),
bgneal@1028 13 ('auth', '0006_require_contenttypes_0002'),
bgneal@1028 14 ]
bgneal@1028 15
bgneal@1028 16 operations = [
bgneal@1028 17 migrations.CreateModel(
bgneal@1028 18 name='Attachment',
bgneal@1028 19 fields=[
bgneal@1028 20 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 21 ('order', models.IntegerField()),
bgneal@1206 22 ('embed', models.ForeignKey(to='oembed.Oembed',
bgneal@1206 23 on_delete=models.CASCADE)),
bgneal@1028 24 ],
bgneal@1028 25 options={
bgneal@1028 26 'ordering': ('order',),
bgneal@1028 27 },
bgneal@1028 28 ),
bgneal@1028 29 migrations.CreateModel(
bgneal@1028 30 name='Category',
bgneal@1028 31 fields=[
bgneal@1028 32 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 33 ('name', models.CharField(max_length=80)),
bgneal@1028 34 ('slug', models.SlugField(max_length=80)),
bgneal@1028 35 ('position', models.IntegerField(default=0, blank=True)),
bgneal@1028 36 ('groups', models.ManyToManyField(help_text=b'If groups are assigned to this category, only members of those groups can view this category.', to='auth.Group', null=True, blank=True)),
bgneal@1028 37 ],
bgneal@1028 38 options={
bgneal@1028 39 'ordering': ('position',),
bgneal@1028 40 'verbose_name_plural': 'Categories',
bgneal@1028 41 },
bgneal@1028 42 ),
bgneal@1028 43 migrations.CreateModel(
bgneal@1028 44 name='FlaggedPost',
bgneal@1028 45 fields=[
bgneal@1028 46 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 47 ('flag_date', models.DateTimeField(auto_now_add=True)),
bgneal@1028 48 ],
bgneal@1028 49 options={
bgneal@1028 50 'ordering': ('flag_date',),
bgneal@1028 51 },
bgneal@1028 52 ),
bgneal@1028 53 migrations.CreateModel(
bgneal@1028 54 name='Forum',
bgneal@1028 55 fields=[
bgneal@1028 56 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 57 ('name', models.CharField(max_length=80)),
bgneal@1028 58 ('slug', models.SlugField(max_length=80)),
bgneal@1028 59 ('description', models.TextField(default=b'', blank=True)),
bgneal@1028 60 ('position', models.IntegerField(default=0, blank=True)),
bgneal@1028 61 ('topic_count', models.IntegerField(default=0, blank=True)),
bgneal@1028 62 ('post_count', models.IntegerField(default=0, blank=True)),
bgneal@1206 63 ('category', models.ForeignKey(related_name='forums',
bgneal@1206 64 to='forums.Category',
bgneal@1206 65 on_delete=models.CASCADE)),
bgneal@1028 66 ],
bgneal@1028 67 options={
bgneal@1028 68 'ordering': ('position',),
bgneal@1028 69 },
bgneal@1028 70 ),
bgneal@1028 71 migrations.CreateModel(
bgneal@1028 72 name='ForumLastVisit',
bgneal@1028 73 fields=[
bgneal@1028 74 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 75 ('begin_date', models.DateTimeField()),
bgneal@1028 76 ('end_date', models.DateTimeField()),
bgneal@1206 77 ('forum', models.ForeignKey(to='forums.Forum',
bgneal@1206 78 on_delete=models.CASCADE)),
bgneal@1206 79 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL,
bgneal@1206 80 on_delete=models.CASCADE)),
bgneal@1028 81 ],
bgneal@1028 82 options={
bgneal@1028 83 'ordering': ('-end_date',),
bgneal@1028 84 },
bgneal@1028 85 ),
bgneal@1028 86 migrations.CreateModel(
bgneal@1028 87 name='Post',
bgneal@1028 88 fields=[
bgneal@1028 89 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 90 ('creation_date', models.DateTimeField(db_index=True)),
bgneal@1028 91 ('update_date', models.DateTimeField(db_index=True)),
bgneal@1028 92 ('body', models.TextField()),
bgneal@1028 93 ('html', models.TextField()),
bgneal@1028 94 ('user_ip', models.IPAddressField(default=b'', null=True, blank=True)),
bgneal@1028 95 ('attachments', models.ManyToManyField(to='oembed.Oembed', through='forums.Attachment')),
bgneal@1028 96 ],
bgneal@1028 97 options={
bgneal@1028 98 'ordering': ('creation_date',),
bgneal@1028 99 'get_latest_by': 'creation_date',
bgneal@1028 100 'verbose_name': 'forum post',
bgneal@1028 101 'verbose_name_plural': 'forum posts',
bgneal@1028 102 },
bgneal@1028 103 ),
bgneal@1028 104 migrations.CreateModel(
bgneal@1028 105 name='Topic',
bgneal@1028 106 fields=[
bgneal@1028 107 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 108 ('name', models.CharField(max_length=255)),
bgneal@1028 109 ('creation_date', models.DateTimeField(db_index=True)),
bgneal@1028 110 ('view_count', models.IntegerField(default=0, blank=True)),
bgneal@1028 111 ('sticky', models.BooleanField(default=False)),
bgneal@1028 112 ('locked', models.BooleanField(default=False)),
bgneal@1028 113 ('post_count', models.IntegerField(default=0, blank=True)),
bgneal@1028 114 ('update_date', models.DateTimeField(db_index=True)),
bgneal@1028 115 ('bookmarkers', models.ManyToManyField(related_name='favorite_topics', verbose_name=b'bookmarkers', to=settings.AUTH_USER_MODEL, blank=True)),
bgneal@1206 116 ('forum', models.ForeignKey(related_name='topics',
bgneal@1206 117 to='forums.Forum',
bgneal@1206 118 on_delete=models.CASCADE)),
bgneal@1206 119 ('last_post', models.OneToOneField(related_name='parent_topic',
bgneal@1206 120 null=True, blank=True,
bgneal@1206 121 to='forums.Post',
bgneal@1206 122 on_delete=models.CASCADE)),
bgneal@1028 123 ('subscribers', models.ManyToManyField(related_name='subscriptions', verbose_name=b'subscribers', to=settings.AUTH_USER_MODEL, blank=True)),
bgneal@1206 124 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL,
bgneal@1206 125 on_delete=models.CASCADE)),
bgneal@1028 126 ],
bgneal@1028 127 options={
bgneal@1028 128 'ordering': ('-sticky', '-update_date'),
bgneal@1028 129 },
bgneal@1028 130 ),
bgneal@1028 131 migrations.CreateModel(
bgneal@1028 132 name='TopicLastVisit',
bgneal@1028 133 fields=[
bgneal@1028 134 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 135 ('last_visit', models.DateTimeField(db_index=True)),
bgneal@1206 136 ('topic', models.ForeignKey(to='forums.Topic',
bgneal@1206 137 on_delete=models.CASCADE)),
bgneal@1206 138 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL,
bgneal@1206 139 on_delete=models.CASCADE)),
bgneal@1028 140 ],
bgneal@1028 141 options={
bgneal@1028 142 'ordering': ('-last_visit',),
bgneal@1028 143 },
bgneal@1028 144 ),
bgneal@1028 145 migrations.AddField(
bgneal@1028 146 model_name='post',
bgneal@1028 147 name='topic',
bgneal@1206 148 field=models.ForeignKey(related_name='posts', to='forums.Topic',
bgneal@1206 149 on_delete=models.CASCADE),
bgneal@1028 150 ),
bgneal@1028 151 migrations.AddField(
bgneal@1028 152 model_name='post',
bgneal@1028 153 name='user',
bgneal@1206 154 field=models.ForeignKey(related_name='posts',
bgneal@1206 155 to=settings.AUTH_USER_MODEL,
bgneal@1206 156 on_delete=models.CASCADE),
bgneal@1028 157 ),
bgneal@1028 158 migrations.AddField(
bgneal@1028 159 model_name='forum',
bgneal@1028 160 name='last_post',
bgneal@1206 161 field=models.OneToOneField(related_name='parent_forum', null=True,
bgneal@1206 162 blank=True, to='forums.Post',
bgneal@1206 163 on_delete=models.CASCADE),
bgneal@1028 164 ),
bgneal@1028 165 migrations.AddField(
bgneal@1028 166 model_name='forum',
bgneal@1028 167 name='moderators',
bgneal@1028 168 field=models.ManyToManyField(to='auth.Group', null=True, blank=True),
bgneal@1028 169 ),
bgneal@1028 170 migrations.AddField(
bgneal@1028 171 model_name='flaggedpost',
bgneal@1028 172 name='post',
bgneal@1206 173 field=models.ForeignKey(to='forums.Post', on_delete=models.CASCADE),
bgneal@1028 174 ),
bgneal@1028 175 migrations.AddField(
bgneal@1028 176 model_name='flaggedpost',
bgneal@1028 177 name='user',
bgneal@1206 178 field=models.ForeignKey(to=settings.AUTH_USER_MODEL,
bgneal@1206 179 on_delete=models.CASCADE),
bgneal@1028 180 ),
bgneal@1028 181 migrations.AddField(
bgneal@1028 182 model_name='attachment',
bgneal@1028 183 name='post',
bgneal@1206 184 field=models.ForeignKey(to='forums.Post', on_delete=models.CASCADE),
bgneal@1028 185 ),
bgneal@1028 186 migrations.AlterUniqueTogether(
bgneal@1028 187 name='topiclastvisit',
bgneal@1028 188 unique_together=set([('user', 'topic')]),
bgneal@1028 189 ),
bgneal@1028 190 migrations.AlterUniqueTogether(
bgneal@1028 191 name='forumlastvisit',
bgneal@1028 192 unique_together=set([('user', 'forum')]),
bgneal@1028 193 ),
bgneal@1028 194 ]