I read your initial question again and, if I understood correctly, you 
should do only a couple of things:

1- Create your custom urlpatterns, for example
url ("^my-search/$", search, name="my_search"),
url ("^", include("mezzanine.urls"))

2- create a copy of the template *search_form.html* in this path
your_project_folder/templates/includes/search_form.html

3- modify the action attribute of the form by putting your urlpattern name 
(my_search )
<form action="{% url "my_search" %}" class="navbar-form navbar-right" role=
"search">

Ready, it works perfectly!


Il giorno martedì 5 settembre 2017 12:20:28 UTC+2, si...@e5r.no ha scritto:
>
> Hi, I’m wondering whether there is any smart way to customize the URL
> used for the built-in Mezzanine search view besides the methods
> mentioned below.
>
> Say that you want to change the search URL from the default `search`
> to `my-search`. A first attempt might be:
>
>   url("^my-search/$", search, name="search"),
>   url("^", include("mezzanine.urls")),
>
> Now you get a search page at `my-search`, but the search view still
> redirects to Mezzanine’s `search` since that one is registered later.
>
> This will fix it, but it doesn’t feel optimal:
>
>   url("^(?!my-search/)", include("mezzanine.urls")),
>   url("^my-search/$", search, name="search"),
>
> Another approach is to give `my-search` another name, copying
> `search_form.html` from Mezzanine and changing `{% url "search" %}` to
> use the new name. This works fine, but it feels a bit wasteful unless
> you’d like to customize the template some more, and it creates more
> work if you’d like to receive updates to `search_form.html` from
> future Mezzanine versions.
>
> Could a cure for all of this be to add a setting for the search URL,
> defaulting to `search`?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to