Ticket #8800: 8800.patch

File 8800.patch, 1.5 KB (added by frasern, 7 years ago)
  • djangodocs/templatetags/docs.py

     
     1from django.core import urlresolvers
    12from django.template import Library
    23
    34from djangodocs.forms import SearchForm
     
    89@register.inclusion_tag('docs/search_form.html', takes_context=True)
    910def search_form(context, search_form_id='search'):
    1011    request = context['request']
     12   
     13    search_url = context['search']
     14    __, __, search_kwargs = urlresolvers.resolve(search_url)
     15   
    1116    auto_id = 'id_%s_%%s' % search_form_id
    1217    return {
    1318        'form': SearchForm(initial=request.GET, auto_id=auto_id),
    1419        'search_form_id': search_form_id,
    15         'action': context['search'],
    16     }
    17  No newline at end of file
     20        'action': search_url,
     21        'lang': search_kwargs['lang'],
     22    }
  • djangodocs/templates/docs/search_form.html

     
    99    {{ form.as_q }}
    1010  </div>
    1111</form>
    12 <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form={{ search_form_id|escape }}&lang={{ lang|escape }}"></script>
    13  No newline at end of file
     12<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form={{ search_form_id|escape }}&amp;lang={{ lang|escape }}"></script>
Back to Top