Hi,

I have been trying to integrate Free Comments following the popular article
-- http://code.djangoproject.com/wiki/UsingFreeComment

I am getting this error.

VariableDoesNotExist at /articles/2006/nov/11/shahjahan/
Failed lookup for key [id] in <Article: Shahjahan>



This my code snippet from article_detail.html, which displays the articles
properly prior to comment integration. I also have provided the model from
models.py.


Curiously this works when I change object.id to object.slug. However I am
unable to see the comments, while rest of it works fine.

{% load comments.comments %}
{% get_free_comment_count for content.article object.id as comment_count %}


<div class="article_menu"><b>Posted on {{ object.date|date:"F j, Y" }}</b>
<a href="{{ object.get_absolute_url }}#comments" class='commentlink'>{{
comment_count }} Comment{{ comment_count|pluralize }}</a><br />Topics: {%
for topic in object.topic_set.all %}{% if not forloop.first %}, {% endif
%}<a href="{{ topic.get_absolute_url }}">{{ topic.title }}</a>{% endfor %}
</div>

{% get_free_comment_list for content.article object.id as comment_list %}
<h2 id="comments">Comments</h2>
{% for comment in comment_list %}
    <div class="comment_{% cycle odd,even %}" id="c{{ comment.id }}">
        <span class="comnum"><a id="c{{ comment.id }}" href="#c{{
comment.id}}">#{{
forloop.counter }}</a></span>
        <p><b>{{ comment.person_name }}</b> commented, on {{
comment.submit_date|date:"F j, Y" }} at {{ comment.submit_date|date:"P"
}}:</p>
        {{ comment.comment|escape|urlizetrunc:40|linebreaks }}
{% endfor %}
<h2>Post a comment</h2>

{% free_comment_form for content.article object.id %}

{% endblock %}


Here is my model


class Article (models.Model):
    author = models.ForeignKey(Author)
    headline = models.CharField (maxlength=100)
    slug = models.SlugField ('Slug', prepopulate_from =('headline',),
primary_key = 'True', help_text= "Shahs, this will be filled automatically
from the name of the author")
    intro = models.CharField (maxlength=320)
    topic     = models.ManyToManyField (Topic)
    slug = models.SlugField ('Slug', prepopulate_from =('headline',),
primary_key = 'True', help_text= "Shahs, this will be filled automatically
from the name of the headline")
    date = models.DateTimeField ('Date')
    keywords = models.CharField (maxlength=144, blank = True)
    body = models.TextField ('body')
    language = models.ManyToManyField (Language, blank = True)
    image = models.ManyToManyField (Image, blank = True, null = True,
default = ' ')
    attachments = models.ManyToManyField (File, blank=True, null = True)
    reference = models.ManyToManyField (Reference,blank = True, null=True)


    def __str__(self):
            return self.headline
        def get_absolute_url(self):
        return "/articles/%s/%s/" % (self.date.strftime("%Y/%b/%d").lower(),
self.slug)
    class Admin:
        list_display = ("headline", "slug", "date","intro","body")
        list_per_page = 25
        search_fields = ("headline", "date", )
        date_hierarchy = 'date'
    class Meta:
        ordering = ('-date',)




Why I am getting this bug? What have I overlooked? Kindly advise


--~--~---------~--~----~------------~-------~--~----~
 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to