@@ -33,7 +33,7 @@ Creating a hook listener in a `third_party_app`:
3333
3434 # Example 1
3535 def css_resources(context, *args, **kwargs):
36- return mark_safe(u '<link rel="stylesheet" href="%s/app_hook/styles.css">' % settings.STATIC_URL)
36+ return mark_safe('<link rel="stylesheet" href="%s/app_hook/styles.css">' % settings.STATIC_URL)
3737
3838
3939 # Example 2
@@ -52,7 +52,8 @@ Creating a hook listener in a `third_party_app`:
5252 # If you are doing this a lot, make sure to keep your templates in memory (google: django.template.loaders.cached.Loader)
5353 return render_to_string(
5454 template_name='templates/app_hook/head_resources.html',
55- context_instance=context
55+ context=dict(context),
56+ request=context.get('request'),
5657 )
5758
5859
@@ -61,8 +62,8 @@ Creating a hook listener in a `third_party_app`:
6162 articles = Article.objects.all()
6263 return render_to_string(
6364 template_name='templates/app_hook/my_articles.html',
64- dictionary ={'articles': articles, },
65- context_instance =context
65+ context ={'articles': articles},
66+ request =context.get('request'),
6667 )
6768
6869Registering a hook listener in a ` third_party_app ` :
@@ -78,7 +79,7 @@ Registering a hook listener in a `third_party_app`:
7879 verbose_name = 'My App'
7980
8081 def ready(self):
81- from hooks .templatehook import hook
82+ from hypha.core .templatehook import hook
8283 from third_party_app.template_hooks import css_resources
8384
8485 hook.register("within_head", css_resources)
0 commit comments