Permalink
Browse files

Add full context to the create_referral tag

  • Loading branch information...
1 parent 774e558 commit a1cf304f9941b811b33e1b2d786b6f38bc514546 @paltman paltman committed Aug 6, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 anafero/templatetags/anafero_tags.py
@@ -8,12 +8,17 @@
register = template.Library()
-@register.inclusion_tag("anafero/_create_referral_form.html")
-def create_referral(url, obj=None):
+@register.inclusion_tag("anafero/_create_referral_form.html", takes_context=True)
+def create_referral(context, url, obj=None):
if obj:
- return {"url": url, "obj": obj, "obj_ct": ContentType.objects.get_for_model(obj)}
+ context.update(
+ {"url": url, "obj": obj, "obj_ct": ContentType.objects.get_for_model(obj)}
+ )
else:
- return {"url": url, "obj": "", "obj_ct": ""}
+ context.update(
+ {"url": url, "obj": "", "obj_ct": ""}
+ )
+ return context
@register.assignment_tag

0 comments on commit a1cf304

Please sign in to comment.