mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 15:51:19 +00:00
253 lines
8.3 KiB
Python
253 lines
8.3 KiB
Python
from __future__ import unicode_literals
|
|
|
|
import datetime
|
|
from datetime import timezone
|
|
|
|
import django.db.models.deletion
|
|
import django.utils.timezone
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
("club", "0006_auto_20161229_0040"),
|
|
("core", "0019_preferences_receive_weekmail"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="Forum",
|
|
fields=[
|
|
(
|
|
"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,
|
|
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,
|
|
),
|
|
),
|
|
(
|
|
"view_groups",
|
|
models.ManyToManyField(
|
|
related_name="viewable_forums",
|
|
to="core.Group",
|
|
blank=True,
|
|
default=[2],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name="ForumMessage",
|
|
fields=[
|
|
(
|
|
"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,
|
|
),
|
|
),
|
|
(
|
|
"readers",
|
|
models.ManyToManyField(
|
|
to=settings.AUTH_USER_MODEL,
|
|
verbose_name="readers",
|
|
related_name="read_messages",
|
|
),
|
|
),
|
|
],
|
|
options={"ordering": ["id"]},
|
|
),
|
|
migrations.CreateModel(
|
|
name="ForumMessageMeta",
|
|
fields=[
|
|
(
|
|
"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",
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="forum_message_metas",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name="ForumTopic",
|
|
fields=[
|
|
(
|
|
"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",
|
|
),
|
|
),
|
|
],
|
|
options={"ordering": ["-id"]},
|
|
),
|
|
migrations.CreateModel(
|
|
name="ForumUserInfo",
|
|
fields=[
|
|
(
|
|
"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=timezone.utc
|
|
),
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.OneToOneField(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to=settings.AUTH_USER_MODEL,
|
|
related_name="_forum_infos",
|
|
),
|
|
),
|
|
],
|
|
),
|
|
migrations.AddField(
|
|
model_name="forummessage",
|
|
name="topic",
|
|
field=models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="messages",
|
|
to="forum.ForumTopic",
|
|
),
|
|
),
|
|
]
|