# Path: philo/utils/templates.py
# LOADED_TEMPLATE_ATTR = '_philo_loaded_template'


from django import template
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.template.loader_tags import ExtendsNode, BlockContext, BLOCK_CONTEXT_KEY, TextNode, BlockNode
from philo.utils.templates import LOADED_TEMPLATE_ATTR
		return self.compile_instance(self.object_pk.resolve(context))
	
	def get_template(self, context):
		if self.template_name is None:
			return None
		return self.compile_template(self.template_name.resolve(context))


class InstanceEmbedNode(EmbedNode):
	def __init__(self, instance, kwargs=None):
		self.instance = instance
		self.kwargs = kwargs or {}
	
	def get_template(self, context):
		return None
	
	def get_instance(self, context):
		return self.instance.resolve(context)
	
	def get_content_type(self, context):
		instance = self.get_instance(context)
		if not instance:
			return None
		return ContentType.objects.get_for_model(instance)


def get_embedded(self):
	return self.template



# Path: philo/utils/templates.py
# LOADED_TEMPLATE_ATTR = '_philo_loaded_template'


# Path: philo/templatetags/embed.py
from django import template
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.template.loader_tags import ExtendsNode, BlockContext, BLOCK_CONTEXT_KEY, TextNode, BlockNode
from philo.utils.templates import LOADED_TEMPLATE_ATTR

		return self.compile_instance(self.object_pk.resolve(context))
	
	def get_template(self, context):
		if self.template_name is None:
			return None
		return self.compile_template(self.template_name.resolve(context))


class InstanceEmbedNode(EmbedNode):
	def __init__(self, instance, kwargs=None):
		self.instance = instance
		self.kwargs = kwargs or {}
	
	def get_template(self, context):
		return None
	
	def get_instance(self, context):
		return self.instance.resolve(context)
	
	def get_content_type(self, context):
		instance = self.get_instance(context)
		if not instance:
			return None
		return ContentType.objects.get_for_model(instance)


def get_embedded(self):
	return self.template



setattr(ConstantEmbedNode, LOADED_TEMPLATE_ATTR, property(get_embedded))