# 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

    return HttpResponse('OK')



class ContetUserView(View):
 def get(self, request):
    if not request.user.is_authenticated():
        return HttpResponse(status=401)

    if not request.is_ajax():
        return HttpResponseBadRequest()

    user_id = request.GET.get('user_id', None)
    print('user_id: {}'.format(user_id))
    content_id = request.GET.get('content_id', None)
    print('content_id: {}'.format(content_id))

    print('is_authenticated: {}'.format(request.user.is_authenticated()))
    print('Raw Data: {}'.format(request.body))
    print('Raw User Id: {}'.format(request.user.id))
    print('request.is_ajax(): {}'.format(request.is_ajax()))

    if User.objects.filter(id__iexact=user_id).exists():
        print('user EXISTS')

        if int(request.user.id) != int(user_id):
            print('request.user.id != user_id')
            return HttpResponseBadRequest('wrong auth user in request')


# 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


    return HttpResponse('OK')



class ContetUserView(View):
 def get(self, request):
    if not request.user.is_authenticated():
        return HttpResponse(status=401)

    if not request.is_ajax():
        return HttpResponseBadRequest()

    user_id = request.GET.get('user_id', None)
    print('user_id: {}'.format(user_id))
    content_id = request.GET.get('content_id', None)
    print('content_id: {}'.format(content_id))

    print('is_authenticated: {}'.format(request.user.is_authenticated()))
    print('Raw Data: {}'.format(request.body))
    print('Raw User Id: {}'.format(request.user.id))
    print('request.is_ajax(): {}'.format(request.is_ajax()))

    if User.objects.filter(id__iexact=user_id).exists():
        print('user EXISTS')

        if int(request.user.id) != int(user_id):
            print('request.user.id != user_id')
            return HttpResponseBadRequest('wrong auth user in request')


        user_instance = User.objects.filter(id=user_id).get()