I think this might be a simple one,
I have installed haystack with whoosh backend. Followed the tutorial and all is working well.
Now I am trying to create a link from other templates to the search url. And I am not figuring out how to do it.
my search url is:
url(r'^search/', include('haystack.urls')),
and I want to refer to link to it from another template. something like:
<a href={% search url %}>
I am using Django 1.3.5 and Haystack 1.2.7
Help would be appreciated.
cheers
a
Ok, so found out the solution for my own question.
In the url declaration, if I use the optional name i can the use it to refer to the search url.
In urls.py:
url(r'^search/', include('haystack.urls'), name='haystack_search')
and in template:
<a ref={% url haystack_search %}>search page</a>
Related
I got a html page like this
<li class="class1 class2"></li>
but I try to find this selector by using
response.xpath('//li[#class="class1 class2"]')
I always got None.
I also try to run this code:
response.xpath('//li[#class="class1"]')
response.xpath('//li[#class="class1 class2"]')
Both return None
Who can tell me what's wrong?
Maybe I resolved but I don't understand. I found a phenomenon that I use DevTools on Chrome, that shows like this <li class="class1 class2"><\li>. But I use scrapy to crawl and return <li class="class1 class2 class3"><\li>
I encountered some phenomenon that the web page source code is different from the source code I crawled.
Main issue is your <li><\li> is not valid HTML like <li></li> and xpath should look like:
.//li[contains(#class, 'class1') and contains(#class, 'class2')]
May use a tool like xpather to check if a path works or not.
I would like to retrieve url from a link on an html page.
unfortunately, html code does not contain any href attribute (I suppose it is managed by some javascript code)
Here is html code :
<p class="ng-scope">
<a class="documentLink ng-binding" data-document-id="21928499">Electronic document</a>
</p>
I tried to do it with getattribute() function :
By linkPodPopover = new ByXpath("//div[#class='popover-content']//a[contains(.,'Electronic document')]");
find(linkPodPopover).getAttribute("href");
but it returns an empty String...
I also tried with this code but also without success :
driver.getCurrentUrl()
click(linkPodPopover)
Do you see another way ?
I did not find any answer on the internet.
And I tried to explore every javascript attribute of the DOM element of my link without finding URL.
Finally, I came across this problem by using browserstack functionnalities : http://browserstack.com/automate/java#enhancements-uploads-downloads
It allows to click on the download link, then the browser download it. then using Javascript, I can check if file is well downloaded, and if size and md5 are correct. –
So this is probably really basic but i have been searching inside and out trying to find the answer, on my site i have a cart and the title of the cart is what i want to change, however in the source it looks like:
<h1 class="text-center">{{ 'cart.general.title' | t }}</h1>
cart.general.title i cannot find any reference to this so i can edit the title, sure i could probably just replace that string with my title but that may not be the efficient approach.
Where can i edit cart.general variables?
Thanks
These are the language variables. They can accessed in Settings-> Checkout->Checkout Language
I have hard-coded the link destination URL in the below link.
I need to re-factor the code so that the URL is set dynamically (reading it from a property file) Any one has an idea how to achieve that in wicket?
Thank you.
You can use org.apache.wicket.markup.html.link.ExternalLink in your Java code. Its model can read/load it from anywhere you need.
This is possible without the need for any Java code.
Given a properties file with a key for the url and the links label:
url = http://www.stackoverflow.com
label = Help me!
One can simple use Wicket message system:
<a wicket:message="href:url"><wicket:message key="label" /></a>
Tested with Wicket 6.19.0
In the Wicket guide: Reading bundles with tag <wicket:message>
Does anyone know how bing's weather webslice search works? I am attempting to create a web slice(only available in IE8) with search built in and I have read that forms are not allowed and neither is javascript. Any help would be appreciated.
You can create active content by defining it on another page using the entry-content rel attribute of an tag. In this example slice.aspx has JavaScript code on it.
<div class="hslice" id="MySlice">
<p class="entry-title">
My Active Slice</p>
<a rel="entry-content" href="slice.aspx" />
<div class="entry-content">
</div>
</div>
You can achieve a similar effect using some simple javascript in a Chrome extension to create an Arbitrary Web Slice extension but with the advantage of being able to take any slice out of any web page, not just predefined Web Slice areas like Bing weather. Obviously only works in Chrome but Firefox has a similar extension API in GreaseMonkey.