+_view_content_type_limiter = ContentTypeSubclassLimiter(None)
+
+
+class Node(TreeEntity):
+ view_content_type = models.ForeignKey(ContentType, related_name='node_view_set', limit_choices_to=_view_content_type_limiter)
+ view_object_id = models.PositiveIntegerField()
+ view = generic.GenericForeignKey('view_content_type', 'view_object_id')
+
+ @property
+ def accepts_subpath(self):
+ if self.view:
+ return self.view.accepts_subpath
+ return False
+
+ def render_to_response(self, request, path=None, subpath=None, extra_context=None):
+ return self.view.render_to_response(self, request, path, subpath, extra_context)
+
+ def get_absolute_url(self):
+ root = Site.objects.get_current().root_node
+ try:
+ return '/%s' % self.get_path(root=root)
+ except AncestorDoesNotExist:
+ return None