Mercurial > public > sg101
comparison 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 |
comparison
equal
deleted
inserted
replaced
1205:510ef3cbf3e6 | 1206:02181fa5ac9d |
---|---|
17 migrations.CreateModel( | 17 migrations.CreateModel( |
18 name='Attachment', | 18 name='Attachment', |
19 fields=[ | 19 fields=[ |
20 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | 20 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
21 ('order', models.IntegerField()), | 21 ('order', models.IntegerField()), |
22 ('embed', models.ForeignKey(to='oembed.Oembed')), | 22 ('embed', models.ForeignKey(to='oembed.Oembed', |
23 on_delete=models.CASCADE)), | |
23 ], | 24 ], |
24 options={ | 25 options={ |
25 'ordering': ('order',), | 26 'ordering': ('order',), |
26 }, | 27 }, |
27 ), | 28 ), |
57 ('slug', models.SlugField(max_length=80)), | 58 ('slug', models.SlugField(max_length=80)), |
58 ('description', models.TextField(default=b'', blank=True)), | 59 ('description', models.TextField(default=b'', blank=True)), |
59 ('position', models.IntegerField(default=0, blank=True)), | 60 ('position', models.IntegerField(default=0, blank=True)), |
60 ('topic_count', models.IntegerField(default=0, blank=True)), | 61 ('topic_count', models.IntegerField(default=0, blank=True)), |
61 ('post_count', models.IntegerField(default=0, blank=True)), | 62 ('post_count', models.IntegerField(default=0, blank=True)), |
62 ('category', models.ForeignKey(related_name='forums', to='forums.Category')), | 63 ('category', models.ForeignKey(related_name='forums', |
64 to='forums.Category', | |
65 on_delete=models.CASCADE)), | |
63 ], | 66 ], |
64 options={ | 67 options={ |
65 'ordering': ('position',), | 68 'ordering': ('position',), |
66 }, | 69 }, |
67 ), | 70 ), |
69 name='ForumLastVisit', | 72 name='ForumLastVisit', |
70 fields=[ | 73 fields=[ |
71 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | 74 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
72 ('begin_date', models.DateTimeField()), | 75 ('begin_date', models.DateTimeField()), |
73 ('end_date', models.DateTimeField()), | 76 ('end_date', models.DateTimeField()), |
74 ('forum', models.ForeignKey(to='forums.Forum')), | 77 ('forum', models.ForeignKey(to='forums.Forum', |
75 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), | 78 on_delete=models.CASCADE)), |
79 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, | |
80 on_delete=models.CASCADE)), | |
76 ], | 81 ], |
77 options={ | 82 options={ |
78 'ordering': ('-end_date',), | 83 'ordering': ('-end_date',), |
79 }, | 84 }, |
80 ), | 85 ), |
106 ('sticky', models.BooleanField(default=False)), | 111 ('sticky', models.BooleanField(default=False)), |
107 ('locked', models.BooleanField(default=False)), | 112 ('locked', models.BooleanField(default=False)), |
108 ('post_count', models.IntegerField(default=0, blank=True)), | 113 ('post_count', models.IntegerField(default=0, blank=True)), |
109 ('update_date', models.DateTimeField(db_index=True)), | 114 ('update_date', models.DateTimeField(db_index=True)), |
110 ('bookmarkers', models.ManyToManyField(related_name='favorite_topics', verbose_name=b'bookmarkers', to=settings.AUTH_USER_MODEL, blank=True)), | 115 ('bookmarkers', models.ManyToManyField(related_name='favorite_topics', verbose_name=b'bookmarkers', to=settings.AUTH_USER_MODEL, blank=True)), |
111 ('forum', models.ForeignKey(related_name='topics', to='forums.Forum')), | 116 ('forum', models.ForeignKey(related_name='topics', |
112 ('last_post', models.OneToOneField(related_name='parent_topic', null=True, blank=True, to='forums.Post')), | 117 to='forums.Forum', |
118 on_delete=models.CASCADE)), | |
119 ('last_post', models.OneToOneField(related_name='parent_topic', | |
120 null=True, blank=True, | |
121 to='forums.Post', | |
122 on_delete=models.CASCADE)), | |
113 ('subscribers', models.ManyToManyField(related_name='subscriptions', verbose_name=b'subscribers', to=settings.AUTH_USER_MODEL, blank=True)), | 123 ('subscribers', models.ManyToManyField(related_name='subscriptions', verbose_name=b'subscribers', to=settings.AUTH_USER_MODEL, blank=True)), |
114 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), | 124 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, |
125 on_delete=models.CASCADE)), | |
115 ], | 126 ], |
116 options={ | 127 options={ |
117 'ordering': ('-sticky', '-update_date'), | 128 'ordering': ('-sticky', '-update_date'), |
118 }, | 129 }, |
119 ), | 130 ), |
120 migrations.CreateModel( | 131 migrations.CreateModel( |
121 name='TopicLastVisit', | 132 name='TopicLastVisit', |
122 fields=[ | 133 fields=[ |
123 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | 134 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
124 ('last_visit', models.DateTimeField(db_index=True)), | 135 ('last_visit', models.DateTimeField(db_index=True)), |
125 ('topic', models.ForeignKey(to='forums.Topic')), | 136 ('topic', models.ForeignKey(to='forums.Topic', |
126 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), | 137 on_delete=models.CASCADE)), |
138 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, | |
139 on_delete=models.CASCADE)), | |
127 ], | 140 ], |
128 options={ | 141 options={ |
129 'ordering': ('-last_visit',), | 142 'ordering': ('-last_visit',), |
130 }, | 143 }, |
131 ), | 144 ), |
132 migrations.AddField( | 145 migrations.AddField( |
133 model_name='post', | 146 model_name='post', |
134 name='topic', | 147 name='topic', |
135 field=models.ForeignKey(related_name='posts', to='forums.Topic'), | 148 field=models.ForeignKey(related_name='posts', to='forums.Topic', |
149 on_delete=models.CASCADE), | |
136 ), | 150 ), |
137 migrations.AddField( | 151 migrations.AddField( |
138 model_name='post', | 152 model_name='post', |
139 name='user', | 153 name='user', |
140 field=models.ForeignKey(related_name='posts', to=settings.AUTH_USER_MODEL), | 154 field=models.ForeignKey(related_name='posts', |
155 to=settings.AUTH_USER_MODEL, | |
156 on_delete=models.CASCADE), | |
141 ), | 157 ), |
142 migrations.AddField( | 158 migrations.AddField( |
143 model_name='forum', | 159 model_name='forum', |
144 name='last_post', | 160 name='last_post', |
145 field=models.OneToOneField(related_name='parent_forum', null=True, blank=True, to='forums.Post'), | 161 field=models.OneToOneField(related_name='parent_forum', null=True, |
162 blank=True, to='forums.Post', | |
163 on_delete=models.CASCADE), | |
146 ), | 164 ), |
147 migrations.AddField( | 165 migrations.AddField( |
148 model_name='forum', | 166 model_name='forum', |
149 name='moderators', | 167 name='moderators', |
150 field=models.ManyToManyField(to='auth.Group', null=True, blank=True), | 168 field=models.ManyToManyField(to='auth.Group', null=True, blank=True), |
151 ), | 169 ), |
152 migrations.AddField( | 170 migrations.AddField( |
153 model_name='flaggedpost', | 171 model_name='flaggedpost', |
154 name='post', | 172 name='post', |
155 field=models.ForeignKey(to='forums.Post'), | 173 field=models.ForeignKey(to='forums.Post', on_delete=models.CASCADE), |
156 ), | 174 ), |
157 migrations.AddField( | 175 migrations.AddField( |
158 model_name='flaggedpost', | 176 model_name='flaggedpost', |
159 name='user', | 177 name='user', |
160 field=models.ForeignKey(to=settings.AUTH_USER_MODEL), | 178 field=models.ForeignKey(to=settings.AUTH_USER_MODEL, |
179 on_delete=models.CASCADE), | |
161 ), | 180 ), |
162 migrations.AddField( | 181 migrations.AddField( |
163 model_name='attachment', | 182 model_name='attachment', |
164 name='post', | 183 name='post', |
165 field=models.ForeignKey(to='forums.Post'), | 184 field=models.ForeignKey(to='forums.Post', on_delete=models.CASCADE), |
166 ), | 185 ), |
167 migrations.AlterUniqueTogether( | 186 migrations.AlterUniqueTogether( |
168 name='topiclastvisit', | 187 name='topiclastvisit', |
169 unique_together=set([('user', 'topic')]), | 188 unique_together=set([('user', 'topic')]), |
170 ), | 189 ), |