1from django.urls import path, register_converter
2class FloatConverter:
3 regex = '[\d\.\d]+'
4
5 def to_python(self, value):
6 return float(value)
7
8 def to_url(self, value):
9 return '{}'.format(value)
10
11register_converter(FloatConverter, 'float')
12
13urlpatterns = [
14 path('admin/', admin.site.urls),
15 path('<float:float_number>/',TemplateView.as_view(template_name='homepage.html')),
16]
17