Oh.. and what is the error you get?
On Wed, Nov 26, 2008 at 13:39, Alfonso <[EMAIL PROTECTED]> wrote: > > Thanks Alex, > > I'm attempting to go the inclusion tag route but having difficulty > understanding how to get the form in place correctly. > > I've defind a simple form within forms.py: > > class PropertySearch(forms.Form): > name = forms.CharField(max_length=100, initial="Property name or > Location") > > and within a templatetag folder under that application, > 'search_form.py' > > from django.template import Library, Node > from pitchup.campsite.forms import PropertySearch > from django import template > > register = Library() > > def show_form(Search): > form = PropertySearch() > return {'form': form} > register.inclusion_tag('property/property_search.html')(show_form) > > But rather predictably that is showing an error... I'm a bit lost, I > understand the inclusion principle for things like 'last 5 blog posts' > etc but including a form seems more difficult? > > Thanks > > On Nov 25, 5:55 pm, "Alex Koshelev" <[EMAIL PROTECTED]> wrote: > > You have to pass form instance to all pages context where it is used. You > > can do it explicitly or write custom context processor or (the better > > solution) write custom inclusion tag. > > > > On Tue, Nov 25, 2008 at 20:13, Alfonso <[EMAIL PROTECTED]> wrote: > > > > > Hey, > > > > > I've put together a simple search form that works perfectly when > > > navigating to the corresponding url - '/search.html'. However I want > > > to reuse that form on multiple pages so where relevant I use {% > > > include 'search.html' %} to inject the form where I need it. > > > > > Problem is this form is devoid of any fields when I do that?? > > > > > The search.html form: > > > <div id="col1"> > > > <form action="."method="POST"> > > > {{ form.as_p }} > > > <p><input type="submit" value="Search"></p> > > > </form> > > > </div> > > > > > Thanks > > > > > Alfonso > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---