Derek Hoy wrote:
> Some of the slug examples use slug as PK.  Funnily enough, your blog
> example does :)
> http://davidavraamides.net/blog/2006/05/11/yet-another-django-blog/

Yes, and that's how I learned about the problem. If you would have
stumbled upon this later post, you would have seen that I ran into it
when I added comments:

http://davidavraamides.net/blog/2006/05/13/adding-comments/

>From that post:

<quote>
The second problem was that while I could enter comments, the same ones
always showed up for all my posts. They didn't seem to have the right
association with the specific post. A quick perusal of the database
showed the problem. The comments_freecomment table uses two fields to
"link" to a blog post: 1) content_type_id which refers to the type of
model in django_content_type, and 2) object_id which refers to the
specific row/instance of the model, in this case a Post.

But as you may recall, my first version used slug, a string, as the
primary key for a Post so all my comments had their object_id set to 0
and thus weren't pointing to any post. This bug resulted in all
comments being shown, no matter which post was displayed. To fix this,
I changed the primary_key argument of the slug field to unique. Since
now I wasn't explicitly setting a primary key for a Post, Django
automatically added one using an integer - just what I needed for the
comments to work.
</quote>

To your point about this being documented in the Django docs: agreed.
Right now there is only this description about the contrib comments app
on the Django documentation site:

  comments
  A simple yet flexible comments system. This is not yet documented.

-Dave


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to