atkawa7
atkawa7

Reputation: 471

Regular expressions in Django

I am new to django and I am having problems with my views. I would like to get all the urls with the extension .html go to a view ...app.views.test

I have:

url(r'^\. html$',views.test)

Upvotes: 0

Views: 74

Answers (1)

alecxe
alecxe

Reputation: 474151

Just check the ending:

url(r'\.html$', views.test)

Note that a dot needs to be escaped with a backslash since the dot has a special meaning:

'.' (Dot.)

In the default mode, this matches any character except a newline.

Upvotes: 3

Related Questions