How Do I Use A Decimal Number In A Django URL Pattern?

前端 未结 4 1580
终归单人心
终归单人心 2021-01-11 17:52

I\'d like to use a number with a decimal point in a Django URL pattern but I\'m not sure whether it\'s actually possible (I\'m not a regex expert).

Here\'s what I wa

4条回答
  •  春和景丽
    2021-01-11 18:36

    If the values to be accepted are only $0.01 or $0.05, the harto's pattern may be specified like this:

    r"^/item/value/(\d\.\d{2})$"
    

提交回复
热议问题