# Path: tests/input/models.py
# class Product(models.Model):
#     pass
# 
# class Category(models.Model):
#     pass


from django.shortcuts import render
from django.http import HttpResponseForbidden
from django.views.generic import TemplateView
from .models import Product, Category
"""Chec for raw access GET and POST dicts"""



def product_list_view(request):
    if request.is_authenticated():
        ctx = {'products': Product.objects.all(),
               'cat_id': request.GET['cat_id']}
        return render(request, 'product_list.html', context=ctx)
    else:
        return HttpResponseForbidden()


class IndexView(TemplateView):

    def get_context_data(self, **kwargs):
        ctx = super(IndexView, self).get_context_data(**kwargs)
        try:
            ctx['cat'] = Category.objects.get(pk=self.request.GET.get('cat_id'))

# Path: tests/input/models.py
# class Product(models.Model):
#     pass
# 
# class Category(models.Model):
#     pass


# Path: tests/input/func_views_raw_get_post_access.py
from django.shortcuts import render
from django.http import HttpResponseForbidden
from django.views.generic import TemplateView
from .models import Product, Category

"""Chec for raw access GET and POST dicts"""



def product_list_view(request):
    if request.is_authenticated():
        ctx = {'products': Product.objects.all(),
               'cat_id': request.GET['cat_id']}
        return render(request, 'product_list.html', context=ctx)
    else:
        return HttpResponseForbidden()


class IndexView(TemplateView):

    def get_context_data(self, **kwargs):
        ctx = super(IndexView, self).get_context_data(**kwargs)
        try:
            ctx['cat'] = Category.objects.get(pk=self.request.GET.get('cat_id'))

        except Category.DoesNotExist: