26👍
✅
I was able to make it work using the configuration given below. Check if it will suit your needs.
(?P<name>[\w|\W]+)
- [Django]-Update django database to reflect changes in existing models
- [Django]-Python NameError: name 'include' is not defined
- [Django]-Django date filter gte and lte
2👍
The best way to do that and allow others chars is using ‘\s’ that is any spaces, tabs and new lines
(?P<name>[\w\s]+)
- [Django]-Django ALLOWED_HOSTS: OK to include 'localhost' on a deployed settings file?
- [Django]-Django: change the value of a field for all objects in a queryset
- [Django]-Run manage.py from AWS EB Linux instance
2👍
I am using Django 2.2.
It handles the %20 (which means space) in url using Path converter: str
You simply need to use:
<name> or <str:name>
For example, following example loads view "some_view" defined in view.py
#urls.py
from django.urls import path
from . import views
urlpatterns = [
path("<name>",views.some_view),
....
]
The following function renders "some.html" after processing. In this example sending the received name to "some.html".
#view.py
def some_view(request, name):
# process here
context = { "name" : name }
return render(request,"some.html",context)
- [Django]-Select_related with reverse foreign keys
- [Django]-How to send html email with django with dynamic content in it?
- [Django]-Django: Does prefetch_related() follow reverse relationship lookup?
Source:stackexchange.com