[PonyORM-list] Problem with iterated linked table
Gamesbrainiac
gamesbrainiac at gmail.com
Thu Nov 20 06:01:20 UTC 2014
Try using:
'"SELECT * FROM "post" ORDER BY "post"."id"'
If I were you, I'd do the following in pony:
Post.select().order_by(Post.id)
Also, my post on Pony might be worth a look ->
http://nafiulis.me/a-todo-app-with-flask-and-pony.html
On Thu, Nov 20, 2014 at 11:43 AM, Pedro Baumann <ondoheer at gmail.com> wrote:
> Hello,
>
> first of all I want to thank you for creating such an intuitive and
> pythonic ORM, I have enjoyed every minute if used it, it's most intuitive
> and it really heps code readability.
>
> I'm having a small problem with my latest project, I hope you can help me.
>
> I'm developing a web app that has a basic "blog like" module.
>
> Post->Comments->Replies
>
> I'm using Flask as a framework.
>
> I'm passing
>
>
> *posts = Post.select_by_sql('SELECT * FROM post ORDER BY id')*
>
> to the template, and then iterating through it to print the comments as in
>
> {% for comment in post.comments %}
> {% if loop.index > numberComments %}{% break %}{% endif %}
> // code code code (HTML)
> {% endfor %}
>
> the problem is the comments come out in random order, varying on each
> iteration.
>
> I need to be able to print the comments in order for my ajax functions
> that retrieve more comments to work.
>
> I think I am missing something here.
>
> Thanks !
>
> *Pedro Baumann Cornejo*
> Psicólogo - Psicoterapeuta - Flores de Bach
> Francisco de Paula Ugarriza 309 dpto. 102 Miraflores.
> Lima
> Perú
>
> _______________________________________________
> ponyorm-list mailing list
> ponyorm-list at ponyorm.org
> /ponyorm-list
>
>
--
Kind Regards,
Quazi Nafiul Islam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20141120/e2bfe9e2/attachment.html>
More information about the ponyorm-list
mailing list