2009/4/12 jrs_66 <jrs...@yahoo.com> > > Hi, > > I'm new to django, but not new to SQL. I have a (seemingly) trivial > query to run. In SQL it looks like- > > SELECT media.*, media_and_containers.order > FROM media > INNER JOIN media_and_containers ON > media.id = media_and_containers.media_id > WHERE media.id = 1 > > In the django ORM I think it should be- > > media = MediaLocal.objects.select_related('order').filter( > mediaandcontainer__media__exact = 1 > ) > > Yet, it seems, media.order does not exist... > > What am I missing? > > On a broader level, is Django's ORM intended for people who don't know > how to write SQL? It seems that many hoops have to be jumped through > to get basic SQL results...
remember MVC, so That is not just for dont write SQL, it is to make the code more clean and no has mixed lang and many reasons you can find, but if you need write SQL would be better if you read the documentation. http://docs.djangoproject.com/en/dev/topics/db/queries/ > > > Thanks, > > jim > > > -- Cristian Salamea CEO GnuThink Software Labs Software Libre / Open Source (+593-8) 4-36-44-48 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---