Just import the mezzanine search view
from mezzanine.core.views import direct_to_template, *search*
your first example wil work well
url("^my-search/$", search, name="search"),
url("^", include("mezzanine.urls")),Il giorno martedì 5 settembre 2017 12:20:28 UTC+2, [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
