Commit 7203e6d1 authored by Bruno Martin's avatar Bruno Martin
Browse files

add forum course relation

parent 9d636b5b
......@@ -31,6 +31,9 @@ class CourseAdmin(admin.ModelAdmin):
filter_horizontal = [
'groups',
]
autocomplete_fields = [
'forum',
]
class UnitInline(admin.TabularInline):
......
# Generated by Django 2.2.14 on 2020-07-25 02:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('discussion', '0023_merge_20200624_0343'),
('courses', '0010_classroom_event'),
]
operations = [
migrations.AddField(
model_name='course',
name='forum',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='course', to='discussion.Forum', verbose_name='Forum'),
),
]
......@@ -16,6 +16,8 @@ from autoslug import AutoSlugField
from .utils import hash_name
from discussion.models import Forum
from .videos.models import Video
from .notes.models import Note
from .course_material.models import CourseMaterial
......@@ -145,6 +147,15 @@ class Course(models.Model):
default=False,
)
forum = models.OneToOneField(
Forum,
models.SET_NULL,
verbose_name=_('Forum'),
related_name='course',
null=True,
blank=True,
)
class Meta:
verbose_name = _('Course')
verbose_name_plural = _('Courses')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment