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" <
daeva...@gmail.com> 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.
>