Solution of 04
This commit is contained in:
+1
-1
@@ -4,5 +4,5 @@ from django.urls import path, re_path
|
||||
urlpatterns = [
|
||||
# use re_path for regex (.*) - this regex accepts anything - see https://docs.python.org/3/library/re.html for more
|
||||
path('', views.home, name=''),
|
||||
re_path('(?P<value>.*)/$', views.home, name='textwiedergabe')
|
||||
re_path('(?P<value>.*)/$', views.home, name='textausgabe')
|
||||
]
|
||||
+7
-4
@@ -1,6 +1,9 @@
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
# Create your views here.
|
||||
|
||||
# if no value is given use the default ''
|
||||
def home(request, value=''):
|
||||
return HttpResponse(value)
|
||||
def home(request, value=""):
|
||||
context = {
|
||||
"title": "Beboop",
|
||||
"message": value
|
||||
}
|
||||
return render(request, 'index.html', context)
|
||||
Reference in New Issue
Block a user