Re: how can i get the object comments are attached to after post?
Thank you very much, Dave :) On 11月16日, 下午11时22分, DavidA <[EMAIL PROTECTED]> wrote: > From a quick scan of the source code, I don't think the object is > passed into the template, but you can get the related content object > directly from the comment (which is passed into the template). Just > use the content_object field of the comment like this: > > {{ comment.content_object.slug }} (or whatever property in the > related object you want to access) > > content_object is a foreign key to the original object so in my case > it's a blog Post object which has a slug field. > > -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?hl=en -~--~~~~--~~--~--~---
Re: how can i get the object comments are attached to after post?
>From a quick scan of the source code, I don't think the object is passed into the template, but you can get the related content object directly from the comment (which is passed into the template). Just use the content_object field of the comment like this: {{ comment.content_object.slug }} (or whatever property in the related object you want to access) content_object is a foreign key to the original object so in my case it's a blog Post object which has a slug field. -Dave On Nov 16, 8:00 am, popufig <[EMAIL PROTECTED]> wrote: > Hi everyone, > > i am now using Django’s comments framework, accoring to the book > , after end user post the > comment, we can create our own template comments/posted.html, and this > template has a variable called object that refers to the object that > received the comment. But i cannot get this object in the template, i > am not sure it's old version feature or not. > > Any help and hints are appreciated! > > Thanks, > Sky --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[django1.0+comment framewok ]how can i get the object comments are attached to after post?
Hi everyone, i am now using Django’s comments framework, accoring to the book , after end user post the comment, we can create our own template comments/posted.html, and this template has a variable called object that refers to the object that received the comment. But i cannot get this object in the template, i am not sure it's old version feature or not. Any help and hints are appreciated! Thanks, Sky --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---