I want to take the URL from request.path
in a template and do a test on just the first word. If my URL is this:
/estimates/commercial
I want to somehow remove the commercial
from the request.path
. I was hoping this is possible within the template, too, since I need to do this check at every page.
Is this possible within my Django template?
EDIT - for clarification
The purpose of this is to highlight the navigation link based on what page is currently being viewed. I have a main nav and a sub nav and I want to highlight as follows:
main nav --> [Systems][Estimates]
"Systems" sub nav ---> [New][Details][Invoives]
If I am in the Details
section of the Systems
section, I want the words System
and Details
to be a different colour, or underlined, or something.