How to check url from namespace

I register all my api urls like this:

url(r'^api/v2/', include("core.api_v2_urls", namespace="api")),

      

I need to check if a given url is.

Can a namespace be used to define it? How?

+3


source to share


1 answer


I have the same problem. You can of course check if a given url is part of all urls, but this is not very DRY ...

It will look like this:



{% url 'firsturl' as first_url %}
{% if request.get_full_path == first_url %}
...do something...
{% endif %}

      

Hope someone finds a better answer! Actually I am using this quite a lot now and it works great :)

0


source







All Articles