From 82efaefd69c4e9e4ff90d7a1763aa95c7ea158f9 Mon Sep 17 00:00:00 2001 From: Zambom Date: Tue, 20 Sep 2016 21:59:10 -0300 Subject: [PATCH] Forum's model [Issue: #81] --- forum/__init__.py | 0 forum/admin.py | 3 +++ forum/apps.py | 5 +++++ forum/migrations/__init__.py | 0 forum/models.py | 22 ++++++++++++++++++++++ forum/tests.py | 3 +++ forum/views.py | 3 +++ 7 files changed, 36 insertions(+), 0 deletions(-) create mode 100644 forum/__init__.py create mode 100644 forum/admin.py create mode 100644 forum/apps.py create mode 100644 forum/migrations/__init__.py create mode 100644 forum/models.py create mode 100644 forum/tests.py create mode 100644 forum/views.py diff --git a/forum/__init__.py b/forum/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/forum/__init__.py diff --git a/forum/admin.py b/forum/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/forum/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/forum/apps.py b/forum/apps.py new file mode 100644 index 0000000..99ee7e7 --- /dev/null +++ b/forum/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ForumConfig(AppConfig): + name = 'forum' diff --git a/forum/migrations/__init__.py b/forum/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/forum/migrations/__init__.py diff --git a/forum/models.py b/forum/models.py new file mode 100644 index 0000000..7fc0272 --- /dev/null +++ b/forum/models.py @@ -0,0 +1,22 @@ +from django.utils.translation import ugettext_lazy as _ +from django.db import models + +from autoslug.fields import AutoSlugField + +from courses.models import Activity + +""" +It's one kind of activity available for a Topic. +It works like a 'topic' of forum, which users can post to it and answer posts of it. +""" +class Forum(Activity): + title = models.CharField(_('Title'), max_length = 100) + description = models.TextField(_('Description'), blank = True) + create_date = models.DateField(_('Create Date'), auto_now_add = True) + + class Meta: + verbose_name = _('Forum') + verbose_name_plural = _('Foruns') + + def __str__(self): + return self.title diff --git a/forum/tests.py b/forum/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/forum/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/forum/views.py b/forum/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/forum/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. -- libgit2 0.21.2