annotate forums/migrations/0001_initial.py @ 1200:b9514abc2a67

Initial commit of ssg101.
author Brian Neal <bgneal@gmail.com>
date Sat, 24 Jun 2023 16:06:51 -0500
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@1028 22 ('embed', models.ForeignKey(to='oembed.Oembed')),
bgneal@1028 23 ],
bgneal@1028 24 options={
bgneal@1028 25 'ordering': ('order',),
bgneal@1028 26 },
bgneal@1028 27 ),
bgneal@1028 28 migrations.CreateModel(
bgneal@1028 29 name='Category',
bgneal@1028 30 fields=[
bgneal@1028 31 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 32 ('name', models.CharField(max_length=80)),
bgneal@1028 33 ('slug', models.SlugField(max_length=80)),
bgneal@1028 34 ('position', models.IntegerField(default=0, blank=True)),
bgneal@1028 35 ('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 36 ],
bgneal@1028 37 options={
bgneal@1028 38 'ordering': ('position',),
bgneal@1028 39 'verbose_name_plural': 'Categories',
bgneal@1028 40 },
bgneal@1028 41 ),
bgneal@1028 42 migrations.CreateModel(
bgneal@1028 43 name='FlaggedPost',
bgneal@1028 44 fields=[
bgneal@1028 45 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 46 ('flag_date', models.DateTimeField(auto_now_add=True)),
bgneal@1028 47 ],
bgneal@1028 48 options={
bgneal@1028 49 'ordering': ('flag_date',),
bgneal@1028 50 },
bgneal@1028 51 ),
bgneal@1028 52 migrations.CreateModel(
bgneal@1028 53 name='Forum',
bgneal@1028 54 fields=[
bgneal@1028 55 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 56 ('name', models.CharField(max_length=80)),
bgneal@1028 57 ('slug', models.SlugField(max_length=80)),
bgneal@1028 58 ('description', models.TextField(default=b'', blank=True)),
bgneal@1028 59 ('position', models.IntegerField(default=0, blank=True)),
bgneal@1028 60 ('topic_count', models.IntegerField(default=0, blank=True)),
bgneal@1028 61 ('post_count', models.IntegerField(default=0, blank=True)),
bgneal@1028 62 ('category', models.ForeignKey(related_name='forums', to='forums.Category')),
bgneal@1028 63 ],
bgneal@1028 64 options={
bgneal@1028 65 'ordering': ('position',),
bgneal@1028 66 },
bgneal@1028 67 ),
bgneal@1028 68 migrations.CreateModel(
bgneal@1028 69 name='ForumLastVisit',
bgneal@1028 70 fields=[
bgneal@1028 71 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 72 ('begin_date', models.DateTimeField()),
bgneal@1028 73 ('end_date', models.DateTimeField()),
bgneal@1028 74 ('forum', models.ForeignKey(to='forums.Forum')),
bgneal@1028 75 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
bgneal@1028 76 ],
bgneal@1028 77 options={
bgneal@1028 78 'ordering': ('-end_date',),
bgneal@1028 79 },
bgneal@1028 80 ),
bgneal@1028 81 migrations.CreateModel(
bgneal@1028 82 name='Post',
bgneal@1028 83 fields=[
bgneal@1028 84 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 85 ('creation_date', models.DateTimeField(db_index=True)),
bgneal@1028 86 ('update_date', models.DateTimeField(db_index=True)),
bgneal@1028 87 ('body', models.TextField()),
bgneal@1028 88 ('html', models.TextField()),
bgneal@1028 89 ('user_ip', models.IPAddressField(default=b'', null=True, blank=True)),
bgneal@1028 90 ('attachments', models.ManyToManyField(to='oembed.Oembed', through='forums.Attachment')),
bgneal@1028 91 ],
bgneal@1028 92 options={
bgneal@1028 93 'ordering': ('creation_date',),
bgneal@1028 94 'get_latest_by': 'creation_date',
bgneal@1028 95 'verbose_name': 'forum post',
bgneal@1028 96 'verbose_name_plural': 'forum posts',
bgneal@1028 97 },
bgneal@1028 98 ),
bgneal@1028 99 migrations.CreateModel(
bgneal@1028 100 name='Topic',
bgneal@1028 101 fields=[
bgneal@1028 102 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 103 ('name', models.CharField(max_length=255)),
bgneal@1028 104 ('creation_date', models.DateTimeField(db_index=True)),
bgneal@1028 105 ('view_count', models.IntegerField(default=0, blank=True)),
bgneal@1028 106 ('sticky', models.BooleanField(default=False)),
bgneal@1028 107 ('locked', models.BooleanField(default=False)),
bgneal@1028 108 ('post_count', models.IntegerField(default=0, blank=True)),
bgneal@1028 109 ('update_date', models.DateTimeField(db_index=True)),
bgneal@1028 110 ('bookmarkers', models.ManyToManyField(related_name='favorite_topics', verbose_name=b'bookmarkers', to=settings.AUTH_USER_MODEL, blank=True)),
bgneal@1028 111 ('forum', models.ForeignKey(related_name='topics', to='forums.Forum')),
bgneal@1028 112 ('last_post', models.OneToOneField(related_name='parent_topic', null=True, blank=True, to='forums.Post')),
bgneal@1028 113 ('subscribers', models.ManyToManyField(related_name='subscriptions', verbose_name=b'subscribers', to=settings.AUTH_USER_MODEL, blank=True)),
bgneal@1028 114 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
bgneal@1028 115 ],
bgneal@1028 116 options={
bgneal@1028 117 'ordering': ('-sticky', '-update_date'),
bgneal@1028 118 },
bgneal@1028 119 ),
bgneal@1028 120 migrations.CreateModel(
bgneal@1028 121 name='TopicLastVisit',
bgneal@1028 122 fields=[
bgneal@1028 123 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
bgneal@1028 124 ('last_visit', models.DateTimeField(db_index=True)),
bgneal@1028 125 ('topic', models.ForeignKey(to='forums.Topic')),
bgneal@1028 126 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
bgneal@1028 127 ],
bgneal@1028 128 options={
bgneal@1028 129 'ordering': ('-last_visit',),
bgneal@1028 130 },
bgneal@1028 131 ),
bgneal@1028 132 migrations.AddField(
bgneal@1028 133 model_name='post',
bgneal@1028 134 name='topic',
bgneal@1028 135 field=models.ForeignKey(related_name='posts', to='forums.Topic'),
bgneal@1028 136 ),
bgneal@1028 137 migrations.AddField(
bgneal@1028 138 model_name='post',
bgneal@1028 139 name='user',
bgneal@1028 140 field=models.ForeignKey(related_name='posts', to=settings.AUTH_USER_MODEL),
bgneal@1028 141 ),
bgneal@1028 142 migrations.AddField(
bgneal@1028 143 model_name='forum',
bgneal@1028 144 name='last_post',
bgneal@1028 145 field=models.OneToOneField(related_name='parent_forum', null=True, blank=True, to='forums.Post'),
bgneal@1028 146 ),
bgneal@1028 147 migrations.AddField(
bgneal@1028 148 model_name='forum',
bgneal@1028 149 name='moderators',
bgneal@1028 150 field=models.ManyToManyField(to='auth.Group', null=True, blank=True),
bgneal@1028 151 ),
bgneal@1028 152 migrations.AddField(
bgneal@1028 153 model_name='flaggedpost',
bgneal@1028 154 name='post',
bgneal@1028 155 field=models.ForeignKey(to='forums.Post'),
bgneal@1028 156 ),
bgneal@1028 157 migrations.AddField(
bgneal@1028 158 model_name='flaggedpost',
bgneal@1028 159 name='user',
bgneal@1028 160 field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
bgneal@1028 161 ),
bgneal@1028 162 migrations.AddField(
bgneal@1028 163 model_name='attachment',
bgneal@1028 164 name='post',
bgneal@1028 165 field=models.ForeignKey(to='forums.Post'),
bgneal@1028 166 ),
bgneal@1028 167 migrations.AlterUniqueTogether(
bgneal@1028 168 name='topiclastvisit',
bgneal@1028 169 unique_together=set([('user', 'topic')]),
bgneal@1028 170 ),
bgneal@1028 171 migrations.AlterUniqueTogether(
bgneal@1028 172 name='forumlastvisit',
bgneal@1028 173 unique_together=set([('user', 'forum')]),
bgneal@1028 174 ),
bgneal@1028 175 ]