On Mon, May 11, 2009 at 12:33 PM, lemming110 <[email protected]> wrote: > > I am trying to use the select keyword in extra. But I cannot properly > quote the the expression for postrgres. I am using the > django.contrib.comments. I started with this snippet > http://www.djangosnippets.org/snippets/1101/ which returns the number > of comments for an object. However, the code does not work. The > problem that the field django_comment.object_pk is text and my item pk > is integer. > > In postgres, this works: > > select count(*) > from django_comments > where django_comments.content_type_id=12 and > django_comments.object_pk='332'; > > But using extra(select={'comment_count': sql,}) where > > sql = '''select count(*) > from django_comments > where django_comments.content_type_id=12 and django_comments.object_pk= > %s''' > > gives me an error every way that I have tried to add quotes. (This > includes django.db.connection.ops.quote_name.) > > Any ideas on how to embedded quotes in postgres?
Please ask questions about how to use Django on the django-users mailing list. This list is for discussion about the development of Django itself. Thanks, Ian --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
