Add basic right management to forum. Need to test it!

This commit is contained in:
Skia
2017-01-21 04:51:37 +01:00
parent 4dd6f01e60
commit ff77df3646
10 changed files with 79 additions and 99 deletions

View File

@ -2,6 +2,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
from django.conf import settings
@ -16,36 +17,45 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Forum',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('name', models.CharField(verbose_name='name', max_length=64)),
('description', models.CharField(default='', verbose_name='description', max_length=256)),
('is_category', models.BooleanField(default=False, verbose_name='is a category')),
('edit_groups', models.ManyToManyField(to='core.Group', blank=True, related_name='editable_forums')),
('owner_group', models.ForeignKey(to='core.Group', default=4, related_name='owned_forums')),
('parent', models.ForeignKey(blank=True, null=True, to='forum.Forum', related_name='children')),
('view_groups', models.ManyToManyField(to='core.Group', blank=True, related_name='viewable_forums')),
('edit_groups', models.ManyToManyField(default=[4], related_name='editable_forums', blank=True, to='core.Group')),
('owner_group', models.ForeignKey(default=12, related_name='owned_forums', to='core.Group')),
('parent', models.ForeignKey(null=True, related_name='children', blank=True, to='forum.Forum')),
('view_groups', models.ManyToManyField(default=[2], related_name='viewable_forums', blank=True, to='core.Group')),
],
),
migrations.CreateModel(
name='ForumMessage',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
('title', models.CharField(default='', blank=True, verbose_name='title', max_length=64)),
('message', models.TextField(verbose_name='message', default='')),
('author', models.ForeignKey(to=settings.AUTH_USER_MODEL, related_name='forum_messages')),
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('title', models.CharField(default='', verbose_name='title', blank=True, max_length=64)),
('message', models.TextField(default='', verbose_name='message')),
('date', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date')),
('author', models.ForeignKey(related_name='forum_messages', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['id'],
},
),
migrations.CreateModel(
name='ForumTopic',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
('author', models.ForeignKey(to=settings.AUTH_USER_MODEL, related_name='forum_topics')),
('forum', models.ForeignKey(to='forum.Forum', related_name='topics')),
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('title', models.CharField(default='', verbose_name='title', max_length=64)),
('description', models.CharField(default='', verbose_name='description', max_length=256)),
('author', models.ForeignKey(related_name='forum_topics', to=settings.AUTH_USER_MODEL)),
('forum', models.ForeignKey(related_name='topics', to='forum.Forum')),
],
options={
'ordering': ['-id'],
},
),
migrations.AddField(
model_name='forummessage',
name='topic',
field=models.ForeignKey(to='forum.ForumTopic', related_name='messages'),
field=models.ForeignKey(related_name='messages', to='forum.ForumTopic'),
),
]

View File

@ -1,19 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forum', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='forumtopic',
name='title',
field=models.CharField(verbose_name='title', max_length=64, default=''),
),
]

View File

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('forum', '0002_forumtopic_title'),
]
operations = [
migrations.AlterModelOptions(
name='forumtopic',
options={'ordering': ['messages__date', '-id']},
),
migrations.AddField(
model_name='forummessage',
name='date',
field=models.DateTimeField(verbose_name='date', default=django.utils.timezone.now),
),
]

View File

@ -1,19 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forum', '0003_auto_20170121_0311'),
]
operations = [
migrations.AddField(
model_name='forumtopic',
name='description',
field=models.CharField(max_length=256, verbose_name='description', default=''),
),
]