Skip to content

Commit

Permalink
Add full context to the create_referral tag
Browse files Browse the repository at this point in the history
  • Loading branch information
paltman committed Aug 6, 2012
1 parent 774e558 commit a1cf304
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions anafero/templatetags/anafero_tags.py
Expand Up @@ -8,12 +8,17 @@
register = template.Library() register = template.Library()




@register.inclusion_tag("anafero/_create_referral_form.html") @register.inclusion_tag("anafero/_create_referral_form.html", takes_context=True)
def create_referral(url, obj=None): def create_referral(context, url, obj=None):
if obj: 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: else:
return {"url": url, "obj": "", "obj_ct": ""} context.update(
{"url": url, "obj": "", "obj_ct": ""}
)
return context




@register.assignment_tag @register.assignment_tag
Expand Down

0 comments on commit a1cf304

Please sign in to comment.