sorry, I meant to say
"It's quite possible i am NOT doing the right thing."....








On Fri, Mar 23, 2012 at 3:24 PM, gowtham <ragowtha...@gmail.com> wrote:

> Yes, That is correct.
>
> Let me step back a bit and explain you what i am trying. It's quite
> possible i am doing the right thing.
>
> I have two models (Library and Result) linked by a third linking model
> (libraryresult (has id, library_id and result_id fields FKeyed to
> respective tables). A many to many relationship.
>
> [ And please point to me if I can query it in any other way?]
>
> I want to pick a set of results (result_id) and want to get all the
> related libraries with them.
>
> 1. So, i query Results first.
> allres = Result.objects.filter(resultslgene__geneid=geneid)
>
> 2. Then for each result_id, i get a library object and store it in a
> dictionary.
>
> reslibdic[res.result_id]=Library.objects.get(libraryresult__result__result_id=res.result_id)
>
> 3. I pass both 'allres' objects list and 'reslibdic' dictionary to
> template to display
>
> {% for res in allres %}
> {{ res.result_id }}
>                 {{ res.genome.organism.organismcode }}
>                 {{ reslibdic.res.result_id.librarycode }} =? this does not
> work obviously. but indicates what i want to do....
>
> {% endfor %}
>
> In template, i want to access the all the library objects (passed as
> dictinary values) and print values for that.
>
> Dictinoary works when I iterate via .items. But not direct access using
> keys. So, i wrote filters.....still i could either get only primary ids of
> the library object or with really customized filters (one for each field in
> library object) i get what i wanted....
>
> Not sure if I clarified well or confused more
>
> Anyway, i really appreciate your efforts to help me.
> Gowthaman
>
> On Fri, Mar 23, 2012 at 3:07 PM, Reinout van Rees <rein...@vanrees.org>wrote:
>
>> On 23-03-12 22:00, gowtham wrote:
>>
>>>
>>> But, i could not get it.  It prints the primary key of the stored object
>>> rather than the object itself.
>>>
>>
>> Well, I don't know what's in the stored object. How are you supposed to
>> print it?
>>
>> Something like <b>{{ my_object.name }}</b>{{ my_object.description }} or
>> so?
>>
>>
>>
>>
>> Reinout
>>
>> --
>> Reinout van Rees                    http://reinout.vanrees.org/
>> rein...@vanrees.org             
>> http://www.nelen-schuurmans.**nl/<http://www.nelen-schuurmans.nl/>
>> "If you're not sure what to do, make something. -- Paul Graham"
>>
>> --
>> 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+unsubscribe@**
>> googlegroups.com <django-users%2bunsubscr...@googlegroups.com>.
>> For more options, visit this group at http://groups.google.com/**
>> group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>
>> .
>>
>>
>
>
> --
> Gowthaman
>
> Bioinformatics Systems Programmer.
> SBRI, 307 West lake Ave N Suite 500
> Seattle, WA. 98109-5219
> Phone : LAB 206-256-7188 (direct).
>



-- 
Gowthaman

Bioinformatics Systems Programmer.
SBRI, 307 West lake Ave N Suite 500
Seattle, WA. 98109-5219
Phone : LAB 206-256-7188 (direct).

-- 
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.

Reply via email to