OdifYltsaeb / django-multilingual

Automatically exported from code.google.com/p/django-multilingual
MIT License
0 stars 0 forks source link

Problem with django-tagging in postgresql #79

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Here is my sample model:

from django.db import models
from tagging.fields import TagField
from tagging.models import Tag
import multilingual
# Create your models here.

class Article(models.Model):
  author = models.CharField(max_length=100)
  pub_date = models.DateTimeField('date published')
  slug = models.SlugField()
  title = models.CharField(max_length=200)
  class Translation(multilingual.Translation):
    body = models.TextField()
  tags = TagField()
  def set_tags(self, tags):
    Tag.objects.update_tags(self, tags)

  def get_tags(self):
    return Tag.objects.get_for_object(self)      

And here is a faulty sql generated:
SELECT 
("news_article_translation_pl"."master_id") 
AS "_trans_master_id_pl", ("news_article_translation_pl"."body") 
AS "_trans_body_pl", ("news_article_translation_pl"."language_id") 
AS "_trans_language_id_pl", ("news_article_translation_en"."id") 
AS "_trans_id_en", ("news_article_translation_pl"."id") 
AS "_trans_id_pl", ("news_article_translation_en"."body") 
AS "_trans_body_en", ("news_article_translation_en"."language_id") 
AS "_trans_language_id_en", ("news_article_translation_en"."master_id") 
AS "_trans_master_id_en", "news_article"."id", "news_article"."author",
"news_article"."pub_date", "news_article"."slug", "news_article"."title",
"news_article"."tags" 
FROM "news_article" , "tagging_taggeditem" 
LEFT JOIN "news_article_translation" AS "news_article_translation_pl" 
ON (("news_article_translation_pl".master_id = "news_article"."id") 
  AND ("news_article_translation_pl".language_id = 2)) 
LEFT JOIN "news_article_translation" AS "news_article_translation_en" 
ON (("news_article_translation_en".master_id = "news_article"."id") 
  AND ("news_article_translation_en".language_id = 1)) 
WHERE "tagging_taggeditem".content_type_id = 12 
AND "tagging_taggeditem".tag_id = 1 
AND "news_article"."id" = "tagging_taggeditem".object_id;

The workaroun described for mySQL version of problem doesn't work here. I'm
using the latest multilingual revision: 144

Original issue reported on code.google.com by pan.piel...@gmail.com on 11 Dec 2008 at 2:49

GoogleCodeExporter commented 8 years ago
Forgot to post the error ;)
Here it is:

poligon=# SELECT COUNT (*)
FROM "news_article" , "tagging_taggeditem"
LEFT JOIN "news_article_translation" AS "news_article_translation_pl"
ON (("news_article_translation_pl".master_id = "news_article"."id")
  AND ("news_article_translation_pl".language_id = 2))
LEFT JOIN "news_article_translation" AS "news_article_translation_en"
ON (("news_article_translation_en".master_id = "news_article"."id")
  AND ("news_article_translation_en".language_id = 1))
WHERE "tagging_taggeditem".content_type_id = 12
AND "tagging_taggeditem".tag_id = 1
AND "news_article"."id" = "tagging_taggeditem".object_id;
ERROR:  invalid reference to FROM-clause entry for table "news_article"
LINE 4: ON (("news_article_translation_pl".master_id = "news_article...
                                                       ^
HINT:  There is an entry for table "news_article", but it cannot be referenced 
from
this part of the query.

Original comment by pan.piel...@gmail.com on 11 Dec 2008 at 3:03