Re: ManyToMany relationship and raw sql queries

2013-05-01 Thread Siddharth Ghumre
Hi , Did you try python psycopg2. A simple deomostration. Ex:- import psycopg2 conn=psycopg2.connect("dbname='xxx' user='xxx' host='localhost' password='xxx'") cur = conn.cursor() query="""SELECT * FROM bookmarkmanager_bookmark b ' 'LEFT JOIN bookmarkmanager_bookmark_tags bt

Re: ManyToMany relationship and raw sql queries

2013-04-27 Thread Marc R
did you use Bookmark.objetcs.all().select_related() ? As this will create a join query... at least for your model you show in the message I have found that for very complex joins, you need to use raw query and not a Model. On Thursday, April 25, 2013 10:44:28 AM UTC-4, Matthieu Bouron wrote

Re: ManyToMany relationship and raw sql queries

2013-04-25 Thread Matthieu Bouron
On Thursday, April 11, 2013 5:39:57 PM UTC+2, Tom Evans wrote: > > On Thu, Apr 11, 2013 at 3:42 PM, Matthieu Bouron > > wrote: > > Hello, > > > > Is there a way to handle many-to-many relationship with raw sql queries > ? > > I have the following model: > > > > from django.db import models

Re: ManyToMany relationship and raw sql queries

2013-04-11 Thread Tom Evans
On Thu, Apr 11, 2013 at 3:42 PM, Matthieu Bouron wrote: > Hello, > > Is there a way to handle many-to-many relationship with raw sql queries ? > I have the following model: > > from django.db import models > > class Tag(models.Model): > name = models.CharField(max_length=512, unique=True) > >

ManyToMany relationship and raw sql queries

2013-04-11 Thread Matthieu Bouron
Hello, Is there a way to handle many-to-many relationship with raw sql queries ? I have the following model: from django.db import models class Tag(models.Model): name = models.CharField(max_length=512, unique=True) class Bookmark(models.Model): link = models.CharField(max_length=512)