Commit 2c4eab9a authored by Julien Enselme's avatar Julien Enselme

Add dynamic view

parent 3fbedc56
......@@ -7,3 +7,14 @@ def offline(request):
def my_page(request):
return render(request, 'pwa/my_page.html')
def say_something(request, key):
things_to_say = {
'hi': 'Hello world',
'bye': 'Have a nice day',
}
thing = things_to_say.get(key, '')
return render(request, 'pwa/say_something.html', context={'thing': thing})
{% extends 'base.html' %}
{% block title %}Test PWA site – Saying something dynamic{% endblock %}
{% block body %}
<h1>Saying something nice</h1>
<p>{{ thing }}</p>
{% endblock %}
......@@ -25,6 +25,7 @@ urlpatterns = [
path('', pwa_views.my_page),
path('offline/', pwa_views.offline),
path('say-something/<str:key>', pwa_views.say_something),
# The service worker cannot be in /static because its scope will be limited to /static.
# Since we want it to have a scope of the full application, we rely on this TemplateView
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment