QuerySet doubt

18 views
Skip to first unread message

Rafael E. Ferrero

unread,
Apr 10, 2014, 11:24:57 PM4/10/14
to django...@googlegroups.com
In my project i have news, every one can have n pic galleries and every gallery can have n pics (every model are in differents apps but that its not the problem) (in the view you can see that i regroup all the pics of galleries related to an article in a single object but this is only for that template, it just part of the requeriments, in other view need have all galleries an his pics, etc.)

When try to pass an object to the template need to every pic must to have related with his news i onli figure out with list

it's, for me, not quiet simple iterate the result of the view in a template... are a better aproach here?, a pythonic aproach maybe?

I put the relevant piece of code here http://linkode.org/IClFZv7NubqSt6u99zDMV2


Saludos Cordiales,
--
Rafael E. Ferrero

Rafael E. Ferrero

unread,
Apr 11, 2014, 12:00:35 AM4/11/14
to django...@googlegroups.com
An SQL who can solve my trouble its here http://linkode.org/DqwJ0ljeE4wdsqw1G9Q8g7

but, with that i obtain something like this:
ArticleTitle                                             GallerieTitle   PicTitle
Fusce luctus scelerisque dolor                una galeria     una foto
Fusce luctus scelerisque dolor                una galeria     otra foto
Lorem Ipsum                                         una galeria     una foto
Lorem Ipsum                                         una galeria     otra foto
Neque porro quisquam est qui dolorem    {null}              {null}
Sed nibh lectus                                      popup albun    primera foto
Sed nibh lectus                                      popup albun    otra fotingui

but i shall iterating over repeated articles data


Saludos Cordiales,
--
Rafael E. Ferrero


Rafael E. Ferrero

unread,
Apr 11, 2014, 1:35:06 AM4/11/14
to django...@googlegroups.com
Found a bug in that view (see revision 3 of linkode) but my ignorance about iterate or perform the object for template still remains.

Saludos Cordiales,
--
Rafael E. Ferrero


Rafael E. Ferrero

unread,
Apr 11, 2014, 8:59:50 AM4/11/14
to django...@googlegroups.com
I think, for what i see on his docs, that https://github.com/chrisglass/django_polymorphic can help in my task.


Saludos Cordiales,
--
Rafael E. Ferrero


Reply all
Reply to author
Forward
0 new messages