开发者

Uncommon django urlpattern

开发者 https://www.devze.com 2022-12-16 05:56 出处:网络
Suppose I\'ve got urls on my site which look like /qwe/asd/zxc/wer/sdf/xcv/ (unknown number of \\w+ blocks separated by slashes).

Suppose I've got urls on my site which look like /qwe/asd/zxc/wer/sdf/xcv/ (unknown number of \w+ blocks separated by slashes).

Is that possible? to construct a urlpattern to catch those urls so that:

  1. a view function would get all those \w+ strings in *args list to it
  2. the {% url qwe asd zxc wer sdf xcv %} templatetag would reconstruct supposed /qwe/asd/zxc/开发者_高级运维wer/sdf/xcv/ url the right way

Thanks


For No.1 (r'^(?P<url>[\w/]+)$', 'views.handler') could do that.

0

精彩评论

暂无评论...
验证码 换一张
取 消