Just have my_fnc return a dictionary (or other object), rather than the
whole rendered response:

def search(request):
..........
   answ = my_fnc(roots)
   return render_to_response("my_fnc.html", { "answ" : answ['FindWord'] } )

def my_fnc( roots ):
   FindWord=authors.objects.filter("name"__contains=roots)
   return { "FindWord" : FindWord }

(A couple of style points:

   - PEP8 recommends avoiding CamelCase in favour of under_scores
   - In views.py, I lean towards naming functions that aren't views, (my_fnc
   in this case) with an underscore, such as _my_fnc)

)

Hope this helps,

Greg


On 3 January 2011 20:45, gintare <g.statk...@gmail.com> wrote:

>
> How formulate correctly the code below:
>
> [code]
> #views.py
>
> def search(request):
> ..........
>    answ = my_fnc(roots)
>    return render_to_response("my_fnc.html", { "answ" : answ } )
>
> def  my_fnc( roots ):
>    FindWord=authors.objects.filter("name"__contains=roots)
>    return render_to_response("my_fnc.html", { " FindWord" :
> FindWord } )
>
> [code]
>
> Gives error Manager isn't accessible via FindWord instances
>
> I would like to get result of quesry in separate function.
> How to return this result to initial function in view or print it to
> *.html form from another function?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 

Dr Greg Turner
Director, the Interaction Consortium
http://interaction.net.au
Phone: +61 2 8060 1067
skype: gregturner
Follow us on twitter:

http://twitter.com/theixc
http://twitter.com/gsta

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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