Rule number one of any html: Only one form per page! I would recommend the usage of template_tags / include tag to control the usage of only one form or the usage of 2 different base.html. Since I'm a strong supporter of DRY I wouldn't 2 different types of base.html but would control the encoding of the base.html form through template_tags.
lazy example: base.html {% if some_param %} {my_base_form} {%end if%} http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ 2011/3/9 maciekjbl <maciej....@gmail.com> > 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> • > <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. > > -- Norberto Leite -- 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.