Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
597 B
19
Indexable
Never
from exercises.views import show_number, hello, random_number, random_number_2


urlpatterns = [
    path('admin/', admin.site.urls),
    path('number/<int:number>/', show_number),
    path('hello/', hello),
    path('random/', random_number),
    #path('random2/<int:number>/', random_number_2)
    re_path(r'^random2/(?P<number>(\d)+)/$', random_number_2)
]

def random_number_2(request, number):
    a = random.randint(0, int(number))
    response_text = """
    <html>
        <body>
            <p> {} </p>
        </body>
    </html>
    """.format(a)
    return HttpResponse(response_text)