Hi,

My problem is how can I separate two request on the same site. This
situation is caused by text field in base template and form in another
template which extends base.

My view.py:

def search(request):
    if 'q' in request.GET:
        term = request.GET['q']
        prod =
Producent.objects.filter(Q(nazwa_producenta__contains=term))
    context = {
        'producent' : prod,
    }
    return render_to_response(
        'promocje/producent_search.html',
        context,
        context_instance = RequestContext(request),
    )

def lista_promocji(request, slug):
    producent = get_object_or_404(Producent, slug=slug)
    promo = PromocjaFilter(request.GET,
queryset=Promocja.objects.filter(producent=producent))
    return render_to_response(
        'promocje/producent_detail.html',
        {"promo" : promo, "prod" : producent }
    )

My base template :
 <form action="{% url promocje-search %}" method="get">
  <a href="{% url promocje-list %}"> Strona Główna </a> &bull;
  <lable for="q">Wyszukaj Producenta:</label> <input type="text"
name="q">

My second template with form (lista_promocji):
  <form action="" method="GET">
        {{ promo.form.as_p }}
        <input type="submit" value="Filtruj" />
    </form>

Now when I try to use form to filter content it triggers input in base
template and I get search view insted of filterd site.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to