Sith/forum/migrations/0001_initial.py

251 lines
8.3 KiB
Python
Raw Permalink Normal View History

2017-01-21 02:42:06 +00:00
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
2017-02-24 02:15:10 +00:00
from django.utils.timezone import utc
2017-01-21 02:42:06 +00:00
from django.conf import settings
2017-02-24 02:15:10 +00:00
import django.utils.timezone
import datetime
import django.db.models.deletion
2017-01-21 02:42:06 +00:00
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
2018-10-04 19:29:19 +00:00
("club", "0006_auto_20161229_0040"),
("core", "0019_preferences_receive_weekmail"),
2017-01-21 02:42:06 +00:00
]
operations = [
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="Forum",
2017-01-21 02:42:06 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
serialize=False,
verbose_name="ID",
auto_created=True,
),
),
("name", models.CharField(max_length=64, verbose_name="name")),
(
"description",
models.CharField(
max_length=256, verbose_name="description", default=""
),
),
(
"is_category",
models.BooleanField(verbose_name="is a category", default=False),
),
(
"edit_groups",
models.ManyToManyField(
related_name="editable_forums",
to="core.Group",
blank=True,
default=[4],
),
),
(
"owner_club",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
2018-10-04 19:29:19 +00:00
to="club.Club",
verbose_name="owner club",
related_name="owned_forums",
default=1,
),
),
(
"parent",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="forum.Forum",
null=True,
related_name="children",
blank=True,
2018-10-04 19:29:19 +00:00
),
),
(
"view_groups",
models.ManyToManyField(
related_name="viewable_forums",
to="core.Group",
blank=True,
default=[2],
),
),
2017-01-21 02:42:06 +00:00
],
),
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="ForumMessage",
2017-01-21 02:42:06 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
serialize=False,
verbose_name="ID",
auto_created=True,
),
),
(
"title",
models.CharField(
max_length=64, blank=True, verbose_name="title", default=""
),
),
("message", models.TextField(verbose_name="message", default="")),
(
"date",
models.DateTimeField(
verbose_name="date", default=django.utils.timezone.now
),
),
(
"author",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="forum_messages",
to=settings.AUTH_USER_MODEL,
2018-10-04 19:29:19 +00:00
),
),
(
"readers",
models.ManyToManyField(
to=settings.AUTH_USER_MODEL,
verbose_name="readers",
related_name="read_messages",
),
),
2017-01-21 02:42:06 +00:00
],
2018-10-04 19:29:19 +00:00
options={"ordering": ["id"]},
2017-01-21 02:42:06 +00:00
),
2017-02-24 02:15:10 +00:00
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="ForumMessageMeta",
2017-02-24 02:15:10 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
serialize=False,
verbose_name="ID",
auto_created=True,
),
),
(
"date",
models.DateTimeField(
verbose_name="date", default=django.utils.timezone.now
),
),
(
"action",
models.CharField(
max_length=16,
choices=[
("EDIT", "Message edited by"),
("DELETE", "Message deleted by"),
("UNDELETE", "Message undeleted by"),
],
verbose_name="action",
),
),
(
"message",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="metas",
to="forum.ForumMessage",
),
2018-10-04 19:29:19 +00:00
),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="forum_message_metas",
to=settings.AUTH_USER_MODEL,
2018-10-04 19:29:19 +00:00
),
),
2017-02-24 02:15:10 +00:00
],
),
2017-01-21 02:42:06 +00:00
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="ForumTopic",
2017-01-21 02:42:06 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
serialize=False,
verbose_name="ID",
auto_created=True,
),
),
(
"description",
models.CharField(
max_length=256, verbose_name="description", default=""
),
),
(
"author",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="forum_topics",
to=settings.AUTH_USER_MODEL,
),
),
(
"forum",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="topics",
to="forum.Forum",
2018-10-04 19:29:19 +00:00
),
),
2017-01-21 02:42:06 +00:00
],
2018-10-04 19:29:19 +00:00
options={"ordering": ["-id"]},
2017-01-21 02:42:06 +00:00
),
2017-02-24 02:15:10 +00:00
migrations.CreateModel(
2018-10-04 19:29:19 +00:00
name="ForumUserInfo",
2017-02-24 02:15:10 +00:00
fields=[
2018-10-04 19:29:19 +00:00
(
"id",
models.AutoField(
primary_key=True,
serialize=False,
verbose_name="ID",
auto_created=True,
),
),
(
"last_read_date",
models.DateTimeField(
verbose_name="last read date",
default=datetime.datetime(1999, 1, 1, 0, 0, tzinfo=utc),
),
),
(
"user",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
related_name="_forum_infos",
2018-10-04 19:29:19 +00:00
),
),
2017-02-24 02:15:10 +00:00
],
),
2017-01-21 02:42:06 +00:00
migrations.AddField(
2018-10-04 19:29:19 +00:00
model_name="forummessage",
name="topic",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="messages",
to="forum.ForumTopic",
),
2017-01-21 02:42:06 +00:00
),
]