Q - returning a data to the template. (many models).

2008-09-29 Thread [EMAIL PROTECTED]
I have a company model which relates to a product model 1-> M. My goal is to search both models and return a result set set that will show the company name and product name that are results of the query. The implementation below only shows the company name. 1. Can I send back the product as well

Re: Q - returning a data to the template. (many models).

2008-09-29 Thread Tom MacKenzie
Thanks. Sounds like a good idea! I will give it try! On Sun, Sep 28, 2008 at 5:54 PM, Erik Allik <[EMAIL PROTECTED]> wrote: > Since a Company could have multiple Products, it's not really possible to > show the product as well with the way you do the querying. > I would instead do a search on the

Re: Q - returning a data to the template. (many models).

2008-09-28 Thread Erik Allik
Since a Company could have multiple Products, it's not really possible to show the product as well with the way you do the querying. I would instead do a search on the Product model and then simply iterate over the resulting products displaying the company for each of them, too: def search(

Re: Q - returning a data to the template. (many models).

2008-09-28 Thread Tom MacKenzie
If anyone could have a look it would be much appreciated. -Tom On Sat, Sep 27, 2008 at 6:40 PM, Tom MacKenzie <[EMAIL PROTECTED]>wrote: > http://django.pastebin.com/d1c579dbf > > Thanks! > > > On Sat, Sep 27, 2008 at 5:48 PM, Ovnicraft <[EMAIL PROTECTED]> wrote: > >> is posible use pastebin? htt

Re: Q - returning a data to the template. (many models).

2008-09-27 Thread Tom MacKenzie
http://django.pastebin.com/d1c579dbf Thanks! On Sat, Sep 27, 2008 at 5:48 PM, Ovnicraft <[EMAIL PROTECTED]> wrote: > is posible use pastebin? http://django.pastebin.com/ > > 2008/9/27 [EMAIL PROTECTED] <[EMAIL PROTECTED]> > >> >> my view is below. >> >> >> >>Search{% if query %} Results{%

Re: Q - returning a data to the template. (many models).

2008-09-27 Thread Ovnicraft
is posible use pastebin? http://django.pastebin.com/ 2008/9/27 [EMAIL PROTECTED] <[EMAIL PROTECTED]> > > my view is below. > > > >Search{% if query %} Results{% endif %} > > > Search > >Search: > > > > > {% if query %} >Results for "{{ query|escape }}": > >{% i

Re: Q - returning a data to the template. (many models).

2008-09-27 Thread [EMAIL PROTECTED]
my view is below. Search{% if query %} Results{% endif %} Search Search: {% if query %} Results for "{{ query|escape }}": {% if results %} {% for company in results %} {{ company|escape }} {% endfor %} {% else %}