mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
forum: add on_delete=models.SET_NULL on _last_message fields
Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
parent
e5ce9658ee
commit
22330e6d9f
@ -2,6 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
@ -22,41 +23,41 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='forum',
|
model_name='forum',
|
||||||
name='_last_message',
|
name='_last_message',
|
||||||
field=models.ForeignKey(related_name='forums_where_its_last', null=True, to='forum.ForumMessage', verbose_name='the last message'),
|
field=models.ForeignKey(verbose_name='the last message', to='forum.ForumMessage', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='forums_where_its_last'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='forum',
|
model_name='forum',
|
||||||
name='_topic_number',
|
name='_topic_number',
|
||||||
field=models.IntegerField(verbose_name='number of topics', default=0),
|
field=models.IntegerField(default=0, verbose_name='number of topics'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='forummessage',
|
model_name='forummessage',
|
||||||
name='_deleted',
|
name='_deleted',
|
||||||
field=models.BooleanField(verbose_name='is deleted', default=False),
|
field=models.BooleanField(default=False, verbose_name='is deleted'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='forumtopic',
|
model_name='forumtopic',
|
||||||
name='_last_message',
|
name='_last_message',
|
||||||
field=models.ForeignKey(related_name='+', null=True, to='forum.ForumMessage', verbose_name='the last message'),
|
field=models.ForeignKey(verbose_name='the last message', to='forum.ForumMessage', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='forumtopic',
|
model_name='forumtopic',
|
||||||
name='_message_number',
|
name='_message_number',
|
||||||
field=models.IntegerField(verbose_name='number of messages', default=0),
|
field=models.IntegerField(default=0, verbose_name='number of messages'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='forumtopic',
|
model_name='forumtopic',
|
||||||
name='_title',
|
name='_title',
|
||||||
field=models.CharField(max_length=64, verbose_name='title', blank=True),
|
field=models.CharField(max_length=64, blank=True, verbose_name='title'),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='forum',
|
model_name='forum',
|
||||||
name='description',
|
name='description',
|
||||||
field=models.CharField(max_length=512, verbose_name='description', default=''),
|
field=models.CharField(max_length=512, default='', verbose_name='description'),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='forum',
|
model_name='forum',
|
||||||
name='id',
|
name='id',
|
||||||
field=models.AutoField(serialize=False, db_index=True, primary_key=True),
|
field=models.AutoField(primary_key=True, serialize=False, db_index=True),
|
||||||
),
|
),
|
||||||
]
|
]
|
@ -58,7 +58,8 @@ class Forum(models.Model):
|
|||||||
view_groups = models.ManyToManyField(Group, related_name="viewable_forums", blank=True,
|
view_groups = models.ManyToManyField(Group, related_name="viewable_forums", blank=True,
|
||||||
default=[settings.SITH_GROUP_PUBLIC_ID])
|
default=[settings.SITH_GROUP_PUBLIC_ID])
|
||||||
number = models.IntegerField(_("number to choose a specific forum ordering"), default=1)
|
number = models.IntegerField(_("number to choose a specific forum ordering"), default=1)
|
||||||
_last_message = models.ForeignKey('ForumMessage', related_name="forums_where_its_last", verbose_name=_("the last message"), null=True)
|
_last_message = models.ForeignKey('ForumMessage', related_name="forums_where_its_last",
|
||||||
|
verbose_name=_("the last message"), null=True, on_delete=models.SET_NULL)
|
||||||
_topic_number = models.IntegerField(_("number of topics"), default=0)
|
_topic_number = models.IntegerField(_("number of topics"), default=0)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -181,7 +182,8 @@ class ForumTopic(models.Model):
|
|||||||
forum = models.ForeignKey(Forum, related_name='topics')
|
forum = models.ForeignKey(Forum, related_name='topics')
|
||||||
author = models.ForeignKey(User, related_name='forum_topics')
|
author = models.ForeignKey(User, related_name='forum_topics')
|
||||||
description = models.CharField(_('description'), max_length=256, default="")
|
description = models.CharField(_('description'), max_length=256, default="")
|
||||||
_last_message = models.ForeignKey('ForumMessage', related_name="+", verbose_name=_("the last message"), null=True)
|
_last_message = models.ForeignKey('ForumMessage', related_name="+", verbose_name=_("the last message"),
|
||||||
|
null=True, on_delete=models.SET_NULL)
|
||||||
_title = models.CharField(_('title'), max_length=64, blank=True)
|
_title = models.CharField(_('title'), max_length=64, blank=True)
|
||||||
_message_number = models.IntegerField(_("number of messages"), default=0)
|
_message_number = models.IntegerField(_("number of messages"), default=0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user