git.ithinksw.org
/
philo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
72849b1
)
Corrected embed handling to ignore embedded instances which do not appear in the...
author
Stephen Burrows
<stephen.r.burrows@gmail.com>
Wed, 1 Dec 2010 21:49:35 +0000
(16:49 -0500)
committer
Stephen Burrows
<stephen.r.burrows@gmail.com>
Wed, 1 Dec 2010 21:49:35 +0000
(16:49 -0500)
templatetags/embed.py
patch
|
blob
|
history
diff --git
a/templatetags/embed.py
b/templatetags/embed.py
index
901e163
..
e8c4cae
100644
(file)
--- a/
templatetags/embed.py
+++ b/
templatetags/embed.py
@@
-65,6
+65,9
@@
def get_embed_dict(embed_list, context):
embeds = {}
for e in embed_list:
ct = e.get_content_type(context)
+ if ct is None:
+ # Then the embed doesn't exist for this context.
+ continue
if ct not in embeds:
embeds[ct] = [e]
else:
@@
-263,7
+266,10
@@
class InstanceEmbedNode(EmbedNode):
return self.instance.resolve(context)
def get_content_type(self, context):
- return ContentType.objects.get_for_model(self.get_instance(context))
+ instance = self.get_instance(context)
+ if instance is None:
+ return None
+ return ContentType.objects.get_for_model(instance)
def get_embedded(self):