0

Maybe this question is repeat it but I cant find an appropriate answer for my specific issue. I have two URL's:

url(r'^dashboard/completar-perfil/(?P<pk>[-_\w]+)/$', CompleteProfileView.as_view()),       

url(r'^dashboard/.*$', DashboardView.as_view()),

As you can see both begin with dashboard. Problem is the first one does not render CompleteProfileView, always renders DashboardView, if I remove dashboard/ from the first URL, it does work fine, how can I achieve that both urls render each of their respective views?

1 Answer 1

1

The problem is that ^dashboard/.*$ is a greedy regular expression that will match everything that start with dashbord/, including dashboard/completar-perfil/.

So, you may need specify better the second regex. Do you really need .* ?

If it is the index of your dashboard, you could use ^dashboard/$. Otherwise, you could put another word between dashboard and your greedy regex, like the following:

r"^dashboard/another-word/.*$"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.