# Path: templation/locals.py
# class LocalsManager(object):
#     def __init__(self):
#     def clear(self):
#     def thread(self):  # pragma: no cover
#     def user(self):
#     def user(self, value):
#     def resource(self):
#     def resource(self, value):
#     def token(self):
#     def token(self, value):
# 
# Path: templation/views.py
# class ResourceStoreMixin(object):
#     """
#     Addicted to Class Based Views? we too! here you had a mixin
#     to add to any DetailView to handle custom templates.
# 
#     If you can't rely con `self.object` or kwargs['pk'] to get the instance,
#     override `get_templation_object()`to return a instance of the resource in
#     `templation.settings.get_resource_model()`.
#     """
#     def get_templation_object(self, *args, **kwargs):
#         return getattr(self, 'object', getattr(kwargs, 'pk', None))
# 
#     def dispatch(self, request, *args, **kwargs):
#         context = super(ResourceStoreMixin, self).dispatch(request, *args,
#                                                            **kwargs)
#         thread_locals.resource = self.get_templation_object(**kwargs)
#         return context
# 
# Path: tests/models.py
# class MyResource(models.Model):
# 
#     name = models.CharField(max_length=50)


from django.shortcuts import render_to_response
from django.views.generic import DetailView
from django.views.generic.base import TemplateView
from templation.locals import thread_locals
from templation.views import ResourceStoreMixin
from .models import MyResource


def index(request, pk):
    thread_locals.resource = pk
    return render_to_response('index.html', {'name': 'John'})



# Path: templation/locals.py
# class LocalsManager(object):
#     def __init__(self):
#     def clear(self):
#     def thread(self):  # pragma: no cover
#     def user(self):
#     def user(self, value):
#     def resource(self):
#     def resource(self, value):
#     def token(self):
#     def token(self, value):
# 
# Path: templation/views.py
# class ResourceStoreMixin(object):
#     """
#     Addicted to Class Based Views? we too! here you had a mixin
#     to add to any DetailView to handle custom templates.
# 
#     If you can't rely con `self.object` or kwargs['pk'] to get the instance,
#     override `get_templation_object()`to return a instance of the resource in
#     `templation.settings.get_resource_model()`.
#     """
#     def get_templation_object(self, *args, **kwargs):
#         return getattr(self, 'object', getattr(kwargs, 'pk', None))
# 
#     def dispatch(self, request, *args, **kwargs):
#         context = super(ResourceStoreMixin, self).dispatch(request, *args,
#                                                            **kwargs)
#         thread_locals.resource = self.get_templation_object(**kwargs)
#         return context
# 
# Path: tests/models.py
# class MyResource(models.Model):
# 
#     name = models.CharField(max_length=50)


# Path: tests/views.py
from django.shortcuts import render_to_response
from django.views.generic import DetailView
from django.views.generic.base import TemplateView
from templation.locals import thread_locals
from templation.views import ResourceStoreMixin
from .models import MyResource



def index(request, pk):
    thread_locals.resource = pk
    return render_to_response('index.html', {'name': 'John'})



class IndexView(ResourceStoreMixin, DetailView):