Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6242113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:53:41+00:00 2026-05-24T11:53:41+00:00

Im trying to build a sidebar form on a website in order to search

  • 0

Im trying to build a sidebar form on a website in order to search some stuff, kind of like this http://cl.ly/0e0R1T0G3B1x0c451F22 where a person can search for something given certain parameters in any part of the website, meaning that the form must be displayed everywhere, and thats where I have the problem.

it seems that the view is not passing the form to the sidebar on the website, what can I do to always send the empty form as a sidebar.

Im trying to be as clear as possible, yet I know that It might not be enough, please let me know, Ill clarify.

This is the view

@render_to(template='league/common_fragments/sidebar_fixturesandresults.html')
def results_fixt_search(request):
results_fixt_search_form = results_fixt_SearchForm(request)

return {'results_fixt_search_form': results_fixt_search_form, }

This is the form, note that Im using django-uni-form

class HorizRadioRenderer(forms.RadioSelect.renderer):
""" this overrides widget method to put radio buttons horizontally
    instead of vertically.
"""
def render(self):
    """Outputs radios"""
    return mark_safe(u'\n'.join([u'%s\n' % w for w in self]))

class results_fixt_SearchForm(forms.Form):

league_search = forms.ChoiceField(choices=[ (league.slug, league.title ) for league in League.objects.all()])
radios = forms.CharField(widget=forms.RadioSelect(renderer=HorizRadioRenderer,
                choices=(('table','Table'),('results','Results'), ('fixtures', 'Fixtures'),)), required=True)


# uniForm Helper
helper = FormHelper()

layout = Layout(
    Fieldset('',
        'league_search', 'radios'
    )
)
helper.add_layout(layout)

# Submit button(s)
submit = Submit('submit','Submit')
helper.add_input(submit)


class Meta:
    fields = ['search_term', 'radios']

def __init__(self, request, *args, **kw):
    super(results_fixt_SearchForm, self).__init__(*args, **kw)
    self.request = request

this is the HTML template

<form action="{% url results_fixt_search %}" method="get" enctype="multipart/form-data" id="results_fixt_search" class="select-form">
    {% with results_fixt_search_form.helper as helper %}
        {% uni_form results_fixt_search_form helper %}
    {% endwith %}
</form>

And this the URL

url(r'^(?i)results_fixt/search/$', 'results_fixt_search', {}, name='results_fixt_search'),
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:53:43+00:00Added an answer on May 24, 2026 at 11:53 am

    You can either include the form html directly (without using django forms for rendering):

    <form action = '{% url search %}' method='GET'>
        <label>Query: <input type='search' name='query'></label>
        <input type='submit' value='Go'>
    </form>
    

    or pass the form instance to all views using context processor:

    def search_form_processor(request):
        return {'search_form': SearchForm()}
    

    and then render the form:

    <form action = '{% url search %}' method='GET'>
        {{ search_form.query.label_tag }} {{ search_form.query }}
        <input type='submit' value='Go'>
    </form>
    

    Form may be processed by its own view at its own url then.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to build a plugin effect that will some what look better than this
I am trying to build a two columned layout with a sidebar that always
I'm trying build an App Engine connected Android application and am having some problems
Trying to build openssl-fips-2.0 with NDK, before I was lucky found this link and
I'm trying to build a map with a series of checkboxes in the sidebar,
Trying to build a simple 1-1 with XMPP protocol like on facebook ( offline,
I am trying to build a website and I want to have a map
I'm trying build this network connection using BroadcastReceiver. When connection doesnt exist it will
I'm brand new to this and I'm trying build a simple layout of divs.
I am trying build an automated testing framework for some of our internal web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.