# Path: mainapp/models.py
# class AutoDateTimeField(models.DateTimeField):
# class Author(models.Model):
# class ContentType(enum.Enum):
# class Content(models.Model):
#     class Meta:
# class ChapterLevelType(enum.Enum):
# class Curiosity(models.Model):
#     class Meta:
# class Chapter(models.Model):
#     class Meta:
# class Module(models.Model):
#     class Meta:
# class ContentStatusType():
# class ContentStatus(models.Model):
# class Faq(models.Model):
#     class Meta(object):
# class Task(models.Model):
#     class Meta(object):
# class TaskSolution(models.Model):
#     def pre_save(self, model_instance, add):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def add_chapters(self, chapters):
#     def add_chapter(self, chapter):
#     def add_content(self, content):
#     def add_contents(self, contents):
#     def prepare_icons_list_from_comment(self):
#     def exists(type_name):
#     def __str__(self):
#     def get_opinions_by_user_id(user_id):
#     def __str__(self):
#     def __str__(self):
#     def save_or_update(task_id, user_id, is_finished, hint_id, time_spent_seconds=1):
#     def __str__(self):
#     TEXT = 1
#     IMAGE = 2
#     MOVIE = 3
#     EXTERNAL_LINK = 4
#     DOWNLOAD_LINK = 5
#     NOTE = 6
#     FORM = 7
#     BEGINNER = 1
#     DEVELOPER = 2
#     EXPERT = 3
#     NEW = 'new'
#     DOIT = 'doit'
#     HELP = 'help'
#     GOOD = 'good'
#     DONE = 'done'
# CONTENT_STATUS_TYPE_CHOICES = (
#     (ContentStatusType.NEW, 'New'),
#     (ContentStatusType.DOIT, 'Doit'),
#     (ContentStatusType.HELP, 'Help'),
#     (ContentStatusType.GOOD, 'Good'),
#     (ContentStatusType.DONE, 'Done'),
# )
#     MAX_HINT_NO = 5


import django
from django.core.files.storage import default_storage
from django.contrib.auth.decorators import login_required
from django.db.models.fields.files import FieldFile
from django.views.generic.base import View, TemplateView
from mainapp.models import User, Author, Module, Chapter, Content, \
                           ContentStatusType, ContentStatus
from django.http import HttpResponse, HttpResponseBadRequest
                    if int(chapter.id) == int(chapter_id):
                        module.add_chapter(chapter)
                        contents_list = Content.objects.select_related()\
                            .filter(chapter=chapter).order_by('additional_text')
            else:
                module.add_chapters(chapters)
            module.prepare_icons_list_from_comment()
            if module_id is None or int(module.id) == int(module_id):
                modules.append(module)
        return {'modules': modules,
                'module_id': module_id,
                'chapter_id': chapter_id,
                'contents_list': contents_list}


class MentorsListPageView(TemplateView):
    template_name = 'mainapp/mentors_list.html'

    def get_context_data(self, **kwargs):
        return {'mentors': Author.objects.filter(is_public_mentor=True)}


class CourseDetailPageView(TemplateView):
    template_name = 'mainapp/course_detail.html'

    def get_context_data(self, **kwargs):
        # module_id = kwargs['module_id']
        chapter_id = kwargs['chapter_id']
        contents_id = kwargs['contents_id']
        chapters = []

# Path: mainapp/models.py
# class AutoDateTimeField(models.DateTimeField):
# class Author(models.Model):
# class ContentType(enum.Enum):
# class Content(models.Model):
#     class Meta:
# class ChapterLevelType(enum.Enum):
# class Curiosity(models.Model):
#     class Meta:
# class Chapter(models.Model):
#     class Meta:
# class Module(models.Model):
#     class Meta:
# class ContentStatusType():
# class ContentStatus(models.Model):
# class Faq(models.Model):
#     class Meta(object):
# class Task(models.Model):
#     class Meta(object):
# class TaskSolution(models.Model):
#     def pre_save(self, model_instance, add):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def add_chapters(self, chapters):
#     def add_chapter(self, chapter):
#     def add_content(self, content):
#     def add_contents(self, contents):
#     def prepare_icons_list_from_comment(self):
#     def exists(type_name):
#     def __str__(self):
#     def get_opinions_by_user_id(user_id):
#     def __str__(self):
#     def __str__(self):
#     def save_or_update(task_id, user_id, is_finished, hint_id, time_spent_seconds=1):
#     def __str__(self):
#     TEXT = 1
#     IMAGE = 2
#     MOVIE = 3
#     EXTERNAL_LINK = 4
#     DOWNLOAD_LINK = 5
#     NOTE = 6
#     FORM = 7
#     BEGINNER = 1
#     DEVELOPER = 2
#     EXPERT = 3
#     NEW = 'new'
#     DOIT = 'doit'
#     HELP = 'help'
#     GOOD = 'good'
#     DONE = 'done'
# CONTENT_STATUS_TYPE_CHOICES = (
#     (ContentStatusType.NEW, 'New'),
#     (ContentStatusType.DOIT, 'Doit'),
#     (ContentStatusType.HELP, 'Help'),
#     (ContentStatusType.GOOD, 'Good'),
#     (ContentStatusType.DONE, 'Done'),
# )
#     MAX_HINT_NO = 5


# Path: static/views.py
import django
from django.core.files.storage import default_storage
from django.contrib.auth.decorators import login_required
from django.db.models.fields.files import FieldFile
from django.views.generic.base import View, TemplateView
from mainapp.models import User, Author, Module, Chapter, Content, \
                           ContentStatusType, ContentStatus
from django.http import HttpResponse, HttpResponseBadRequest

                    if int(chapter.id) == int(chapter_id):
                        module.add_chapter(chapter)
                        contents_list = Content.objects.select_related()\
                            .filter(chapter=chapter).order_by('additional_text')
            else:
                module.add_chapters(chapters)
            module.prepare_icons_list_from_comment()
            if module_id is None or int(module.id) == int(module_id):
                modules.append(module)
        return {'modules': modules,
                'module_id': module_id,
                'chapter_id': chapter_id,
                'contents_list': contents_list}


class MentorsListPageView(TemplateView):
    template_name = 'mainapp/mentors_list.html'

    def get_context_data(self, **kwargs):
        return {'mentors': Author.objects.filter(is_public_mentor=True)}


class CourseDetailPageView(TemplateView):
    template_name = 'mainapp/course_detail.html'

    def get_context_data(self, **kwargs):
        # module_id = kwargs['module_id']
        chapter_id = kwargs['chapter_id']
        contents_id = kwargs['contents_id']
        chapters = []

        chapters_tmp = Chapter.objects.filter(id=chapter_id)